/[anubis]/anubis/src/env.c
ViewVC logotype

Diff of /anubis/src/env.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by gray, Tue Feb 11 16:51:09 2003 UTC revision 1.5 by polak, Wed Feb 19 11:02:27 2003 UTC
# Line 35  static struct pam_conv conv = { Line 35  static struct pam_conv conv = {
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
# Line 70  get_options(int argc, char *argv[]) Line 82  get_options(int argc, char *argv[])
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();
# Line 154  get_options(int argc, char *argv[]) Line 166  get_options(int argc, char *argv[])
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  }  }
# Line 226  check_superuser(void) Line 237  check_superuser(void)
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);
# Line 248  anubis_changeowner(char *user) Line 259  anubis_changeowner(char *user)
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) {

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26