Auto-reload for rlm_fastusers and rlm_unix
[freeradius.git] / src / modules / rlm_unix / rlm_unix.c
1 /*
2  * rlm_unix.c   authentication: Unix user authentication
3  *              accounting:     Functions to write radwtmp file.
4  *              Also contains handler for "Group".
5  *
6  * Version:     $Id$
7  *
8  *   This program is free software; you can redistribute it and/or modify
9  *   it under the terms of the GNU General Public License as published by
10  *   the Free Software Foundation; either version 2 of the License, or
11  *   (at your option) any later version.
12  *
13  *   This program is distributed in the hope that it will be useful,
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *   GNU General Public License for more details.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with this program; if not, write to the Free Software
20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  *
22  * Copyright 2000  The FreeRADIUS server project
23  * Copyright 2000  Jeff Carneal <jeff@apex.net>
24  * Copyright 2000  Alan Curry <pacman@world.std.com>
25  */
26 static const char rcsid[] = "$Id$";
27
28 #include        "autoconf.h"
29 #include        "libradius.h"
30
31 #include        <stdlib.h>
32 #include        <string.h>
33 #include        <grp.h>
34 #include        <pwd.h>
35 #include        <sys/types.h>
36 #include        <sys/stat.h>
37
38 #include "config.h"
39
40 #if HAVE_SHADOW_H
41 #  include      <shadow.h>
42 #endif
43
44 #if HAVE_CRYPT_H
45 #  include <crypt.h>
46 #endif
47
48 #ifdef OSFC2
49 #  include      <sys/security.h>
50 #  include      <prot.h>
51 #endif
52
53 #ifdef OSFSIA
54 #  include      <sia.h>
55 #  include      <siad.h>
56 #endif
57
58 #include        "radiusd.h"
59 #include        "modules.h"
60 #include        "sysutmp.h"
61 #include        "cache.h"
62 #include        "conffile.h"
63
64 static char trans[64] =
65    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
66 #define ENC(c) trans[c]
67
68 struct unix_instance {
69         int cache_passwd;
70         const char *passwd_file;
71         const char *shadow_file;
72         const char *group_file;
73         const char *radwtmp;
74         int usegroup;
75         struct pwcache *cache;
76         time_t cache_reload;
77         time_t next_reload;
78         time_t last_reload;
79 };
80
81 static CONF_PARSER module_config[] = {
82         /*
83          *      Cache the password by default.
84          */
85         { "cache",    PW_TYPE_BOOLEAN,
86           offsetof(struct unix_instance,cache_passwd), NULL, "yes" },
87         { "passwd",   PW_TYPE_STRING_PTR,
88           offsetof(struct unix_instance,passwd_file), NULL,  NULL },
89         { "shadow",   PW_TYPE_STRING_PTR,
90           offsetof(struct unix_instance,shadow_file), NULL,  NULL },
91         { "group",    PW_TYPE_STRING_PTR,
92           offsetof(struct unix_instance,group_file), NULL,   NULL },
93         { "radwtmp",  PW_TYPE_STRING_PTR,
94           offsetof(struct unix_instance,radwtmp), NULL,   "${logdir}/radwtmp" },
95         { "usegroup", PW_TYPE_BOOLEAN,
96           offsetof(struct unix_instance,usegroup), NULL,     "no" },
97         { "cache_reload", PW_TYPE_INTEGER,
98           offsetof(struct unix_instance,cache_reload), NULL, "600" },
99         
100         { NULL, -1, 0, NULL, NULL }             /* end the list */
101 };
102
103 /*
104  * groupcmp is part of autz. But it uses the data from an auth instance. So
105  * here is where it gets it. By default this will be the first configured
106  * auth instance. That can be changed by putting "usegroup = yes" inside an
107  * auth instance to explicitly bind all Group checks to it.
108  */
109
110 /* binds "Group=" to an instance (a particular passwd file) */
111 static struct unix_instance *group_inst;
112
113 /* Tells if the above binding was explicit (usegroup=yes specified in config
114  * file) or not ("Group=" was bound to the first instance of rlm_unix */
115 static int group_inst_explicit;
116
117 struct passwd *fgetpwnam(const char *fname, const char *name) {
118         FILE            *file = fopen(fname, "ro");
119         struct passwd   *pwd = NULL;
120
121         if(file == NULL) return NULL;
122         do {
123                 pwd = fgetpwent(file);
124                 if(pwd == NULL) {
125                         fclose(file);
126                         return NULL;
127                 }
128         } while(strcmp(name, pwd->pw_name) != 0);
129         fclose(file);
130         return pwd;
131 }
132
133 struct passwd *fgetgrnam(const char *fname, const char *name) {
134         FILE            *file = fopen(fname, "ro");
135         struct group    *grp = NULL;
136         if(file == NULL) return NULL;
137         do {
138                 grp = fgetgrent(file);
139                 if(grp == NULL) {
140                         fclose(file);
141                         return NULL;
142                 }
143         } while(strcmp(name, grp->gr_name) != 0);
144         fclose(file);
145         return grp;
146 }
147
148 /*
149  *      The Group = handler.
150  */
151 static int groupcmp(void *instance, VALUE_PAIR *request, VALUE_PAIR *check,
152         VALUE_PAIR *check_pairs, VALUE_PAIR **reply_pairs)
153 {
154         struct passwd   *pwd;
155         struct group    *grp;
156         char            **member;
157         char            *username;
158         int             retval;
159
160         instance = instance;
161         check_pairs = check_pairs;
162         reply_pairs = reply_pairs;
163
164         if (!group_inst) {
165                 radlog(L_ERR, "groupcmp: no group list known.");
166                 return 1;
167         }
168
169         username = (char *)request->strvalue;
170
171         if (group_inst->cache_passwd &&
172             (retval = H_groupcmp(group_inst->cache, check, username)) != -2)
173                 return retval;
174
175         if ((pwd = fgetpwnam(group_inst->passwd_file, username)) == NULL)
176                 return -1;
177
178         if ((grp = fgetgrnam(group_inst->group_file, (char *)check->strvalue)) == NULL)
179                 return -1;
180
181         retval = (pwd->pw_gid == grp->gr_gid) ? 0 : -1;
182         if (retval < 0) {
183                 for (member = grp->gr_mem; *member && retval; member++) {
184                         if (strcmp(*member, pwd->pw_name) == 0)
185                                 retval = 0;
186                 }
187         }
188         return retval;
189 }
190
191
192 /*
193  *      FIXME:  We really should have an 'init' which makes
194  *      System auth == Unix
195  */
196 static int unix_init(void)
197 {
198         /* FIXME - delay these until a group file has been read so we know
199          * groupcmp can actually do something */
200         paircompare_register(PW_GROUP, PW_USER_NAME, groupcmp, NULL);
201 #ifdef PW_GROUP_NAME /* compat */
202         paircompare_register(PW_GROUP_NAME, PW_USER_NAME, groupcmp, NULL);
203 #endif
204         return 0;
205 }
206
207 static int unix_instantiate(CONF_SECTION *conf, void **instance)
208 {
209         struct unix_instance *inst;
210
211         /*
212          *      Allocate room for the instance.
213          */
214         inst = *instance = rad_malloc(sizeof(struct unix_instance));
215
216         /*
217          *      Parse the configuration, failing if we can't do so.
218          */
219         if (cf_section_parse(conf, inst, module_config) < 0) {
220                 free(inst);
221                 return -1;
222         }
223
224         if (inst->cache_passwd) {
225                 radlog(L_INFO, "HASH:  Reinitializing hash structures "
226                         "and lists for caching...");
227                 if ((inst->cache = unix_buildpwcache(inst->passwd_file,
228                                                      inst->shadow_file,
229                                                      inst->group_file))==NULL)
230                 {
231                         radlog(L_ERR, "HASH:  unable to create user "
232                                 "hash table.  disable caching and run debugs");
233                         free((char *) inst->passwd_file);
234                         free((char *) inst->shadow_file);
235                         free((char *) inst->group_file);
236                         free((char *) inst->radwtmp);
237                         free(inst);
238                         return -1;
239                 }
240
241                 if (inst->cache_reload) {
242                         inst->last_reload = 0;
243                         inst->next_reload = time(NULL) + inst->cache_reload;
244                 }
245         } else {
246                 inst->cache = NULL;
247         }
248
249         if (inst->usegroup) {
250                 if (group_inst_explicit) {
251                         radlog(L_ERR, "Only one group list may be active");
252                 } else {
253                         group_inst = inst;
254                         group_inst_explicit = 1;
255                 }
256         } else if (!group_inst) {
257                 group_inst = inst;
258         }
259 #undef inst
260
261         return 0;
262 }
263
264 /*
265  *      Detach.
266  */
267 static int unix_detach(void *instance)
268 {
269 #define inst ((struct unix_instance *)instance)
270         if (group_inst == inst) {
271                 group_inst = NULL;
272                 group_inst_explicit = 0;
273         }
274         free((char *) inst->passwd_file);
275         free((char *) inst->shadow_file);
276         free((char *) inst->group_file);
277         free((char *) inst->radwtmp);
278         if (inst->cache) {
279                 unix_freepwcache(inst->cache);
280         }
281 #undef inst
282         free(instance);
283         return 0;
284 }
285
286 static int unix_destroy(void)
287 {
288         paircompare_unregister(PW_GROUP, groupcmp);
289 #ifdef PW_GROUP_NAME
290         paircompare_unregister(PW_GROUP_NAME, groupcmp);
291 #endif
292         return 0;
293 }
294
295
296 /*
297  *      Check the users password against the standard UNIX
298  *      password table.
299  */
300 static int unix_authenticate(void *instance, REQUEST *request)
301 {
302 #define inst ((struct unix_instance *)instance)
303         char *name, *passwd;
304         struct passwd   *pwd;
305         char            *encpw;
306         char            *encrypted_pass;
307         int             ret;
308 #if HAVE_GETSPNAM
309 #if defined(M_UNIX)
310         struct passwd   *spwd;
311 #else
312         struct spwd     *spwd;
313 #endif
314 #endif
315 #ifdef OSFC2
316         struct pr_passwd *pr_pw;
317 #endif
318 #ifdef OSFSIA
319         char            *info[2];
320         char            *progname = "radius";
321         SIAENTITY       *ent = NULL;
322 #endif
323 #ifdef HAVE_GETUSERSHELL
324         char            *shell;
325 #endif
326
327         /* See if we should refresh the cache */
328         if (inst->cache && inst->cache_reload
329          && (inst->next_reload < request->timestamp)) {
330                 /* Time to refresh, maybe ? */
331                 int must_reload = 0;
332                 struct stat statbuf;
333
334                 DEBUG2("rlm_users : Time to refresh cache.");
335                 /* Check if any of the files has changed */
336                 if (inst->passwd_file
337                  && (stat(inst->passwd_file, &statbuf) != -1)
338                  && (statbuf.st_mtime > inst->last_reload)) {
339                         must_reload++;
340                 }
341
342                 if (inst->shadow_file
343                  && (stat(inst->shadow_file, &statbuf) != -1)
344                  && (statbuf.st_mtime > inst->last_reload)) {
345                         must_reload++;
346                 }
347
348                 if (inst->group_file
349                  && (stat(inst->group_file, &statbuf) != -1)
350                  && (statbuf.st_mtime > inst->last_reload)) {
351                         must_reload++;
352                 }
353
354                 if (must_reload) {
355                         /* Build a new cache to replace old one */
356                         struct pwcache *oldcache;
357                         struct pwcache *newcache = unix_buildpwcache(
358                                                         inst->passwd_file,
359                                                         inst->shadow_file,
360                                                         inst->group_file);
361
362                         if (newcache) {
363                                 oldcache = inst->cache;
364                                 inst->cache = newcache;
365                                 unix_freepwcache(oldcache);
366
367                                 inst->last_reload = time(NULL);
368                         }
369                 } else {
370                         DEBUG2("rlm_users : Files were unchanged. Not reloading.");
371                 }
372
373                 /* Schedule next refresh */
374                 inst->next_reload = time(NULL) + inst->cache_reload;
375         }
376
377         /*
378          *      We can only authenticate user requests which HAVE
379          *      a User-Name attribute.
380          */
381         if (!request->username) {
382                 radlog(L_AUTH, "rlm_unix: Attribute \"User-Name\" is required for authentication.");
383                 return RLM_MODULE_INVALID;
384         }
385
386         /*
387          *      We can only authenticate user requests which HAVE
388          *      a Password attribute.
389          */
390         if (!request->password) {
391                 radlog(L_AUTH, "rlm_unix: Attribute \"Password\" is required for authentication.");
392                 return RLM_MODULE_INVALID;
393         }
394
395         /*
396          *  Ensure that we're being passed a plain-text password,
397          *  and not anything else.
398          */
399         if (request->password->attribute != PW_PASSWORD) {
400                 radlog(L_AUTH, "rlm_unix: Attribute \"Password\" is required for authentication.  Cannot use \"%s\".", request->password->name);
401                 return RLM_MODULE_INVALID;
402         }
403
404         name = (char *)request->username->strvalue;
405         passwd = (char *)request->password->strvalue;
406
407         if (inst->cache_passwd &&
408             (ret = H_unix_pass(inst->cache, name, passwd, &request->reply->vps)) != -2)
409                 return (ret == 0) ? RLM_MODULE_OK : RLM_MODULE_REJECT;
410
411 #ifdef OSFSIA
412         info[0] = progname;
413         info[1] = NULL;
414         if (sia_ses_init (&ent, 1, info, NULL, name, NULL, 0, NULL) !=
415             SIASUCCESS)
416                 return RLM_MODULE_NOTFOUND;
417         if ((ret = sia_ses_authent (NULL, passwd, ent)) != SIASUCCESS) {
418                 if (ret & SIASTOP)
419                         sia_ses_release (&ent);
420                 return RLM_MODULE_NOTFOUND;
421         }
422         if (sia_ses_estab (NULL, ent) == SIASUCCESS) {
423                 sia_ses_release (&ent);
424                 return RLM_MODULE_OK;
425         }
426
427         return RLM_MODULE_NOTFOUND;
428 #else /* OSFSIA */
429 #ifdef OSFC2
430         if ((pr_pw = getprpwnam(name)) == NULL)
431                 return RLM_MODULE_NOTFOUND;
432         encrypted_pass = pr_pw->ufld.fd_encrypt;
433 #else /* OSFC2 */
434         /*
435          *      Get encrypted password from password file
436          */
437         if ((pwd = getpwnam(name)) == NULL) {
438                 return RLM_MODULE_NOTFOUND;
439         }
440         encrypted_pass = pwd->pw_passwd;
441 #endif /* OSFC2 */
442
443 #if HAVE_GETSPNAM
444         /*
445          *      See if there is a shadow password.
446          */
447         if ((spwd = getspnam(name)) != NULL)
448 #if defined(M_UNIX)
449                 encrypted_pass = spwd->pw_passwd;
450 #else
451                 encrypted_pass = spwd->sp_pwdp;
452 #endif  /* M_UNIX */
453 #endif  /* HAVE_GETSPNAM */
454
455 #ifdef DENY_SHELL
456         /*
457          *      Undocumented temporary compatibility for iphil.NET
458          *      Users with a certain shell are always denied access.
459          */
460         if (strcmp(pwd->pw_shell, DENY_SHELL) == 0) {
461                 radlog(L_AUTH, "rlm_unix: [%s]: invalid shell", name);
462                 return RLM_MODULE_REJECT;
463         }
464 #endif
465
466 #if HAVE_GETUSERSHELL
467         /*
468          *      Check /etc/shells for a valid shell. If that file
469          *      contains /RADIUSD/ANY/SHELL then any shell will do.
470          */
471         while ((shell = getusershell()) != NULL) {
472                 if (strcmp(shell, pwd->pw_shell) == 0 ||
473                     strcmp(shell, "/RADIUSD/ANY/SHELL") == 0) {
474                         break;
475                 }
476         }
477         endusershell();
478         if (shell == NULL)
479                 return RLM_MODULE_REJECT;
480 #endif
481
482 #if defined(HAVE_GETSPNAM) && !defined(M_UNIX)
483         /*
484          *      Check if password has expired.
485          */
486         if (spwd && spwd->sp_expire > 0 &&
487             (request->timestamp / 86400) > spwd->sp_expire) {
488                 radlog(L_AUTH, "rlm_unix: [%s]: password has expired", name);
489                 return RLM_MODULE_REJECT;
490         }
491 #endif
492
493 #if defined(__FreeBSD__) || defined(bsdi) || defined(_PWF_EXPIRE)
494         /*
495          *      Check if password has expired.
496          */
497         if ((pwd->pw_expire > 0) &&
498             (request->timestamp > pwd->pw_expire)) {
499                 radlog(L_AUTH, "rlm_unix: [%s]: password has expired", name);
500                 return RLM_MODULE_REJECT;
501         }
502 #endif
503
504 #ifdef OSFC2
505         /*
506          *      Check if account is locked.
507          */
508         if (pr_pw->uflg.fg_lock!=1) {
509                 radlog(L_AUTH, "rlm_unix: [%s]: account locked", name);
510                 return RLM_MODULE_USERLOCK;
511         }
512 #endif /* OSFC2 */
513
514         /*
515          *      We might have a passwordless account.
516          */
517         if (encrypted_pass[0] == 0)
518                 return RLM_MODULE_OK;
519
520         /*
521          *      Check encrypted password.
522          */
523         encpw = crypt(passwd, encrypted_pass);
524         if (strcmp(encpw, encrypted_pass))
525                 return RLM_MODULE_REJECT;
526
527         return RLM_MODULE_OK;
528 #endif /* OSFSIA */
529 #undef inst
530 }
531
532 /*
533  *      UUencode 4 bits base64. We use this to turn a 4 byte field
534  *      (an IP address) into 6 bytes of ASCII. This is used for the
535  *      wtmp file if we didn't find a short name in the naslist file.
536  */
537 static char *uue(void *in)
538 {
539         int i;
540         static unsigned char res[7];
541         unsigned char *data = (unsigned char *)in;
542
543         res[0] = ENC( data[0] >> 2 );
544         res[1] = ENC( ((data[0] << 4) & 060) + ((data[1] >> 4) & 017) );
545         res[2] = ENC( ((data[1] << 2) & 074) + ((data[2] >> 6) & 03) );
546         res[3] = ENC( data[2] & 077 );
547
548         res[4] = ENC( data[3] >> 2 );
549         res[5] = ENC( (data[3] << 4) & 060 );
550         res[6] = 0;
551
552         for(i = 0; i < 6; i++) {
553                 if (res[i] == ' ') res[i] = '`';
554                 if (res[i] < 32 || res[i] > 127)
555                         printf("uue: protocol error ?!\n");
556         }
557         return (char *)res;
558 }
559
560
561 /*
562  *      Unix accounting - write a wtmp file.
563  */
564 static int unix_accounting(void *instance, REQUEST *request)
565 {
566         VALUE_PAIR      *vp;
567         NAS             *cl;
568         FILE            *fp;
569         struct utmp     ut;
570         time_t          t;
571         char            buf[64];
572         const char      *s;
573         int             delay = 0;
574         int             status = -1;
575         int             nas_address = 0;
576         int             framed_address = 0;
577         int             protocol = -1;
578         int             nas_port = 0;
579         int             port_seen = 0;
580         int             nas_port_type = 0;
581         struct unix_instance *inst = (struct unix_instance *) instance;
582
583         /*
584          *      Which type is this.
585          */
586         if ((vp = pairfind(request->packet->vps, PW_ACCT_STATUS_TYPE))==NULL) {
587                 radlog(L_ERR, "Accounting: no Accounting-Status-Type record.");
588                 return RLM_MODULE_NOOP;
589         }
590         status = vp->lvalue;
591
592         /*
593          *      FIXME: handle PW_STATUS_ALIVE like 1.5.4.3 did.
594          */
595         if (status != PW_STATUS_START &&
596             status != PW_STATUS_STOP)
597                 return RLM_MODULE_NOOP;
598
599         /*
600          *      We're only interested in accounting messages
601          *      with a username in it.
602          */
603         if ((vp = pairfind(request->packet->vps, PW_USER_NAME)) == NULL)
604                 return RLM_MODULE_NOOP;
605
606         t = request->timestamp;
607         memset(&ut, 0, sizeof(ut));
608
609         /*
610          *      First, find the interesting attributes.
611          */
612         for (vp = request->packet->vps; vp; vp = vp->next) {
613                 switch (vp->attribute) {
614                         case PW_USER_NAME:
615                                 if (vp->length >= sizeof(ut.ut_name)) {
616                                         memcpy(ut.ut_name, (char *)vp->strvalue, sizeof(ut.ut_name));
617                                 } else {
618                                         strNcpy(ut.ut_name, (char *)vp->strvalue, sizeof(ut.ut_name));
619                                 }
620                                 break;
621                         case PW_LOGIN_IP_HOST:
622                         case PW_FRAMED_IP_ADDRESS:
623                                 framed_address = vp->lvalue;
624                                 break;
625                         case PW_FRAMED_PROTOCOL:
626                                 protocol = vp->lvalue;
627                                 break;
628                         case PW_NAS_IP_ADDRESS:
629                                 nas_address = vp->lvalue;
630                                 break;
631                         case PW_NAS_PORT_ID:
632                                 nas_port = vp->lvalue;
633                                 port_seen = 1;
634                                 break;
635                         case PW_ACCT_DELAY_TIME:
636                                 delay = vp->lvalue;
637                                 break;
638                         case PW_NAS_PORT_TYPE:
639                                 nas_port_type = vp->lvalue;
640                                 break;
641                 }
642         }
643
644         /*
645          *      We don't store !root sessions, or sessions
646          *      where we didn't see a PW_NAS_PORT_ID.
647          */
648         if (strncmp(ut.ut_name, "!root", sizeof(ut.ut_name)) == 0 || !port_seen)
649                 return RLM_MODULE_NOOP;
650
651         /*
652          *      If we didn't find out the NAS address, use the
653          *      originator's IP address.
654          */
655         if (nas_address == 0)
656                 nas_address = request->packet->src_ipaddr;
657
658 #ifdef __linux__
659         /*
660          *      Linux has a field for the client address.
661          */
662         ut.ut_addr = framed_address;
663 #endif
664         /*
665          *      We use the tty field to store the terminal servers' port
666          *      and address so that the tty field is unique.
667          */
668         s = "";
669         if ((cl = nas_find(nas_address)) != NULL)
670                 s = cl->shortname;
671         if (s == NULL || s[0] == 0) s = uue(&(nas_address));
672         sprintf(buf, "%03d:%s", nas_port, s);
673         strNcpy(ut.ut_line, buf, sizeof(ut.ut_line));
674
675         /*
676          *      We store the dynamic IP address in the hostname field.
677          */
678 #ifdef UT_HOSTSIZE
679         if (framed_address) {
680                 ip_ntoa(buf, framed_address);
681                 strncpy(ut.ut_host, buf, UT_HOSTSIZE);
682         }
683 #endif
684 #ifdef HAVE_UTMPX_H
685         ut.ut_xtime = t- delay;
686 #else
687         ut.ut_time = t - delay;
688 #endif
689 #ifdef USER_PROCESS
690         /*
691          *      And we can use the ID field to store
692          *      the protocol.
693          */
694         if (protocol == PW_PPP)
695                 strcpy(ut.ut_id, "P");
696         else if (protocol == PW_SLIP)
697                 strcpy(ut.ut_id, "S");
698         else
699                 strcpy(ut.ut_id, "T");
700         ut.ut_type = status == PW_STATUS_STOP ? DEAD_PROCESS : USER_PROCESS;
701 #endif
702         if (status == PW_STATUS_STOP)
703                 ut.ut_name[0] = 0;
704
705         /*
706          *      Write a RADIUS wtmp log file.
707          *
708          *      Try to open the file if we can't, we don't write the
709          *      wtmp file. If we can try to write. If we fail,
710          *      return RLM_MODULE_FAIL ..
711          */
712         if ((fp = fopen(inst->radwtmp, "a")) != NULL) {
713                 if ((fwrite(&ut, sizeof(ut), 1, fp)) != 1) {
714                         fclose(fp);
715                         return RLM_MODULE_FAIL;
716                 }
717                 fclose(fp);
718         } else 
719                 return RLM_MODULE_FAIL;
720
721         return RLM_MODULE_OK;
722 }
723
724 /* globally exported name */
725 module_t rlm_unix = {
726   "System",
727   RLM_TYPE_THREAD_UNSAFE,        /* type: reserved */
728   unix_init,                    /* initialization */
729   unix_instantiate,             /* instantiation */
730   {
731           unix_authenticate,    /* authentication */
732           NULL,                 /* authorization */
733           NULL,                 /* preaccounting */
734           unix_accounting,      /* accounting */
735           NULL                  /* checksimul */
736   },
737   unix_detach,                  /* detach */
738   unix_destroy,                  /* destroy */
739 };
740