--- lmtp2nntp_config.c 2002/01/31 15:32:51 1.32
+++ lmtp2nntp_config.c 2002/01/31 15:42:31 1.33
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <sys/stat.h>
#include <errno.h>
+#include <pwd.h>
/* third party (included) */
#include "lmtp2nntp_argz.h"
@@ -747,6 +748,32 @@
catch (ex)
rethrow;
+ /* --user SINGLE */
+ try {
+ struct passwd *sPasswd;
+
+ if ( (val_get(ctx->val, "option.user", &ov) != VAL_OK)
+ || (ov->ndata != 1)
+ || (ov->data.s == NULL)
+ ) throw(0,0,0);
+ log1(ctx, TRACE, "--user = \"%s\"", ov->data.s);
+
+ if (isdigit((int)ov->data.s[0])) {
+ if ((sPasswd = getpwuid((uid_t)atoi(ov->data.s))) == NULL) {
+ log1(ctx, ERROR, "option --user, uid (%s) not found", ov->data.s);
+ throw(0,0,0);
+ }
+ }
+ else {
+ if ((sPasswd = getpwnam(optarg)) == NULL) {
+ log1(ctx, ERROR, "option --user, name (%s) not found", ov->data.s);
+ throw(0,0,0);
+ }
+ }
+ ctx->option_uid = sPasswd->pw_uid;
+ }
+ catch (ex)
+ rethrow;
CUS:
return;
}
|