Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
af24726a
...
af24726ac5249e01cef0be547ff5c135244a4b53
authored
2006-12-15 15:16:15 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Allow to be run from console by a non-privileged user (useful with fetchmail)
1 parent
9278bca6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
3 deletions
mail.local/main.c
mail.local/main.c
View file @
af24726
...
...
@@ -24,7 +24,7 @@ int ex_quota_tempfail; /* Return temporary failure if mailbox quota is
exceeded. If this variable is not set, mail.local
will return "service unavailable" */
int
exit_code
=
EX_OK
;
/* Exit code to be used */
uid_t
uid
;
/* Current user
name
*/
uid_t
uid
;
/* Current user
id
*/
char
*
quotadbname
=
NULL
;
/* Name of mailbox quota database */
char
*
quota_query
=
NULL
;
/* SQL query to retrieve mailbox quota */
...
...
@@ -334,8 +334,14 @@ main (int argc, char *argv[])
/* Parse command line */
mu_argp_parse
(
&
argp
,
&
argc
,
&
argv
,
0
,
argp_capa
,
&
arg_index
,
NULL
);
uid
=
getuid
();
if
(
uid
==
0
)
{
openlog
(
"mail.local"
,
LOG_PID
,
log_facility
);
mu_error_set_print
(
mu_syslog_error_printer
);
}
if
(
debug_flags
)
{
int
rc
;
...
...
@@ -359,16 +365,32 @@ main (int argc, char *argv[])
}
}
uid
=
getuid
();
argc
-=
arg_index
;
argv
+=
arg_index
;
if
(
!
argc
)
{
if
(
uid
)
{
static
char
*
s_argv
[
2
];
struct
mu_auth_data
*
auth
=
mu_get_auth_by_uid
(
uid
);
if
(
!
uid
)
{
mu_error
(
_
(
"Cannot get username"
));
return
EX_UNAVAILABLE
;
}
s_argv
[
0
]
=
auth
->
name
;
argv
=
s_argv
;
argc
=
1
;
}
else
{
mu_error
(
_
(
"Missing arguments. Try --help for more info."
));
return
EX_USAGE
;
}
}
/* Register local mbox formats. */
mu_registrar_record
(
mu_mbox_record
);
...
...
@@ -663,6 +685,8 @@ deliver (mu_mailbox_t imbx, char *name)
exit_code
=
EX_UNAVAILABLE
;
return
;
}
if
(
uid
)
auth
->
change_uid
=
0
;
if
(
!
sieve_test
(
auth
,
imbx
))
{
...
...
Please
register
or
sign in
to post a comment