]> git.pld-linux.org Git - packages/cyrus-imapd.git/blame - cyrus-deliver-wrapper.c
- rel 1
[packages/cyrus-imapd.git] / cyrus-deliver-wrapper.c
CommitLineData
21160fd9
AF
1/*
2 * Wrapper for cyrus 'deliver' to allow anyone to run it -
3 * I hope this is secure! Should be setgid mail.
4 */
5
6#include <stdio.h>
7#include <unistd.h>
8#include <pwd.h>
9#include <sys/types.h>
10#include <sysexits.h>
11
12#ifndef LIBEXECDIR
13#define LIBEXECDIR "/usr/libexec/cyrus"
14#endif
15
16int main(int argc, char *argv[])
17{
18 char *const envp[] = { NULL };
19 struct passwd *ent = getpwuid(getuid());
20 const char *uname = (ent && ent->pw_name && ent->pw_name[0])
21 ? ent->pw_name : "anonymous";
22
23 if (argc != 2) {
24 fprintf(stderr, "Usage: %s mailbox\n", argv[0]);
25 return EX_USAGE;
26 }
27
28 execle(LIBEXECDIR"/deliver", "deliver", "-e",
29 "-a", uname, "-m", argv[1],
30 NULL, envp);
31
32 perror("exec "LIBEXECDIR"/deliver");
33 return EX_OSERR;
34}
This page took 0.216664 seconds and 4 git commands to generate.