The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/boot/bootauth.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #include <u.h>
    2 #include <libc.h>
    3 #include <auth.h>
    4 #include <fcall.h>
    5 #include "../boot/boot.h"
    6 
    7 char    *authaddr;
    8 static void glenda(void);
    9 
   10 void
   11 authentication(int cpuflag)
   12 {
   13         char *argv[16], **av;
   14         int ac;
   15 
   16         if(access("/boot/factotum", AEXEC) < 0){
   17                 glenda();
   18                 return;
   19         }
   20 
   21         /* start agent */
   22         ac = 0;
   23         av = argv;
   24         av[ac++] = "factotum";
   25         if(getenv("debugfactotum"))
   26                 av[ac++] = "-p";
   27 //      av[ac++] = "-d";                /* debug traces */
   28 //      av[ac++] = "-D";                /* 9p messages */
   29         if(cpuflag)
   30                 av[ac++] = "-S";
   31         else
   32                 av[ac++] = "-u";
   33         av[ac++] = "-sfactotum";
   34         if(authaddr != nil){
   35                 av[ac++] = "-a";
   36                 av[ac++] = authaddr;
   37         }
   38         av[ac] = 0;
   39         switch(fork()){
   40         case -1:
   41                 fatal("starting factotum");
   42         case 0:
   43                 exec("/boot/factotum", av);
   44                 fatal("execing /boot/factotum");
   45         default:
   46                 break;
   47         }
   48 
   49         /* wait for agent to really be there */
   50         while(access("/mnt/factotum", 0) < 0)
   51                 sleep(250);
   52 
   53         if(cpuflag)
   54                 return;
   55 }
   56 
   57 static void
   58 glenda(void)
   59 {
   60         int fd;
   61         char *s;
   62 
   63         s = getenv("user");
   64         if(s == nil)
   65                 s = "glenda";
   66 
   67         fd = open("#c/hostowner", OWRITE);
   68         if(fd >= 0){
   69                 if(write(fd, s, strlen(s)) != strlen(s))
   70                         fprint(2, "setting #c/hostowner to %s: %r\n", s);
   71                 close(fd);
   72         }
   73 }

Cache object: aa9260e9b33d33a2c20743b57dc7e7c7


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.