35 |
}; |
}; |
36 |
#endif /* HAVE_PAM */ |
#endif /* HAVE_PAM */ |
37 |
|
|
38 |
|
static char ** |
39 |
|
argv_dup(int argc, char **argv) |
40 |
|
{ |
41 |
|
char **xargv = xmalloc((argc + 1) * sizeof(*xargv)); |
42 |
|
int i; |
43 |
|
|
44 |
|
for (i = 0; i < argc; i++) |
45 |
|
xargv[i] = strdup(argv[i]); |
46 |
|
xargv[i] = NULL; |
47 |
|
return xargv; |
48 |
|
} |
49 |
|
|
50 |
static int gindex = 0; |
static int gindex = 0; |
51 |
|
|
52 |
#define OPT_VERSION 257 |
#define OPT_VERSION 257 |
82 |
int c; |
int c; |
83 |
|
|
84 |
while ((c = getopt_long(argc, argv, "b:r:l:fisvD?", |
while ((c = getopt_long(argc, argv, "b:r:l:fisvD?", |
85 |
gopt, &gindex)) != EOF) { |
gopt, &gindex)) != EOF) { |
86 |
switch (c) { |
switch (c) { |
87 |
case OPT_HELP: |
case OPT_HELP: |
88 |
print_usage(); |
print_usage(); |
166 |
else |
else |
167 |
ptr = session.execpath; |
ptr = session.execpath; |
168 |
session.execargs = gen_execargs(ptr); |
session.execargs = gen_execargs(ptr); |
|
topt |= T_RCEXECARGS; |
|
169 |
} |
} |
170 |
} |
} |
171 |
else |
else |
172 |
session.execargs = argv + optind; |
session.execargs = argv_dup(argc - optind, argv + optind); |
173 |
} |
} |
174 |
return; |
return; |
175 |
} |
} |
237 |
void |
void |
238 |
anubis_changeowner(char *user) |
anubis_changeowner(char *user) |
239 |
{ |
{ |
240 |
#ifdef HAVE_PAM |
#ifdef HAVE_PAM |
241 |
int pam_retval; |
int pam_retval; |
242 |
#endif /* HAVE_PAM */ |
#endif /* HAVE_PAM */ |
243 |
struct passwd *pwd; |
struct passwd *pwd; |
244 |
|
|
245 |
if (user == 0 || check_superuser() == 0) |
if (user == 0 || check_superuser() == 0) |
246 |
return; |
return; |
247 |
|
|
248 |
#ifdef HAVE_PAM |
#ifdef HAVE_PAM |
249 |
pam_retval = pam_start("anubis", user, &conv, &pamh); |
pam_retval = pam_start("anubis", user, &conv, &pamh); |
250 |
if (pam_retval == PAM_SUCCESS) |
if (pam_retval == PAM_SUCCESS) |
251 |
pam_retval = pam_authenticate(pamh, 0); |
pam_retval = pam_authenticate(pamh, 0); |
259 |
info(NORMAL, _("PAM: Not authenticated to use GNU Anubis.")); |
info(NORMAL, _("PAM: Not authenticated to use GNU Anubis.")); |
260 |
quit(EXIT_FAILURE); |
quit(EXIT_FAILURE); |
261 |
} |
} |
262 |
#endif /* HAVE_PAM */ |
#endif /* HAVE_PAM */ |
263 |
|
|
264 |
pwd = getpwnam(user); |
pwd = getpwnam(user); |
265 |
if (pwd) { |
if (pwd) { |