diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2012-03-31 12:25:48 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2012-03-31 12:25:48 +0000 |
| commit | e6d8f97bf2e0bbb4d95df0c4e030eb7ec6ef75a5 (patch) | |
| tree | 4f6fdadb51cbe1a2bb3b2b06c9bcabb0429d1a84 /roundcubemail/plugins/password/helpers/chgdbmailusers.c | |
| parent | 868c169e2a64c1d19a9b6bbcd98f268808dfd173 (diff) | |
Move plugins repository into roundcubemail root folder; svn:externals are not defined anymore
git-svn-id: https://svn.roundcube.net/trunk@6034 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/plugins/password/helpers/chgdbmailusers.c')
| -rw-r--r-- | roundcubemail/plugins/password/helpers/chgdbmailusers.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/roundcubemail/plugins/password/helpers/chgdbmailusers.c b/roundcubemail/plugins/password/helpers/chgdbmailusers.c new file mode 100644 index 000000000..28f79c100 --- /dev/null +++ b/roundcubemail/plugins/password/helpers/chgdbmailusers.c @@ -0,0 +1,48 @@ +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +// set the UID this script will run as (root user) +#define UID 0 +#define CMD "/usr/sbin/dbmail-users" +#define RCOK 0x100 + +/* INSTALLING: + gcc -o chgdbmailusers chgdbmailusers.c + chown root.apache chgdbmailusers + strip chgdbmailusers + chmod 4550 chgdbmailusers +*/ + +main(int argc, char *argv[]) +{ + int cnt,rc,cc; + char cmnd[255]; + + strcpy(cmnd, CMD); + + if (argc > 1) + { + for (cnt = 1; cnt < argc; cnt++) + { + strcat(cmnd, " "); + strcat(cmnd, argv[cnt]); + } + } + else + { + fprintf(stderr, "__ %s: failed %d %d\n", argv[0], rc, cc); + return 255; + } + + cc = setuid(UID); + rc = system(cmnd); + + if ((rc != RCOK) || (cc != 0)) + { + fprintf(stderr, "__ %s: failed %d %d\n", argv[0], rc, cc); + return 1; + } + + return 0; +} |
