write log message about invalid shells and invalid password
[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                 radlog(L_AUTH, "rlm_unix: [%s]: invalid shell [%s]",
480                         name, pws->pw_shell);
481                 return RLM_MODULE_REJECT;
482         }
483 #endif
484
485 #if defined(HAVE_GETSPNAM) && !defined(M_UNIX)
486         /*
487          *      Check if password has expired.
488          */
489         if (spwd && spwd->sp_expire > 0 &&
490             (request->timestamp / 86400) > spwd->sp_expire) {
491                 radlog(L_AUTH, "rlm_unix: [%s]: password has expired", name);
492                 return RLM_MODULE_REJECT;
493         }
494 #endif
495
496 #if defined(__FreeBSD__) || defined(bsdi) || defined(_PWF_EXPIRE)
497         /*
498          *      Check if password has expired.
499          */
500         if ((pwd->pw_expire > 0) &&
501             (request->timestamp > pwd->pw_expire)) {
502                 radlog(L_AUTH, "rlm_unix: [%s]: password has expired", name);
503                 return RLM_MODULE_REJECT;
504         }
505 #endif
506
507 #ifdef OSFC2
508         /*
509          *      Check if account is locked.
510          */
511         if (pr_pw->uflg.fg_lock!=1) {
512                 radlog(L_AUTH, "rlm_unix: [%s]: account locked", name);
513                 return RLM_MODULE_USERLOCK;
514         }
515 #endif /* OSFC2 */
516
517         /*
518          *      We might have a passwordless account.
519          */
520         if (encrypted_pass[0] == 0)
521                 return RLM_MODULE_OK;
522
523         /*
524          *      Check encrypted password.
525          */
526         encpw = crypt(passwd, encrypted_pass);
527         if (strcmp(encpw, encrypted_pass)) {
528                 radlog(L_AUTH, "rlm_unix: [%s]: invalid password", name);
529                 return RLM_MODULE_REJECT;
530         }
531         return RLM_MODULE_OK;
532 #endif /* OSFSIA */
533 #undef inst
534 }
535
536 /*
537  *      UUencode 4 bits base64. We use this to turn a 4 byte field
538  *      (an IP address) into 6 bytes of ASCII. This is used for the
539  *      wtmp file if we didn't find a short name in the naslist file.
540  */
541 static char *uue(void *in)
542 {
543         int i;
544         static unsigned char res[7];
545         unsigned char *data = (unsigned char *)in;
546
547         res[0] = ENC( data[0] >> 2 );
548         res[1] = ENC( ((data[0] << 4) & 060) + ((data[1] >> 4) & 017) );
549         res[2] = ENC( ((data[1] << 2) & 074) + ((data[2] >> 6) & 03) );
550         res[3] = ENC( data[2] & 077 );
551
552         res[4] = ENC( data[3] >> 2 );
553         res[5] = ENC( (data[3] << 4) & 060 );
554         res[6] = 0;
555
556         for(i = 0; i < 6; i++) {
557                 if (res[i] == ' ') res[i] = '`';
558                 if (res[i] < 32 || res[i] > 127)
559                         printf("uue: protocol error ?!\n");
560         }
561         return (char *)res;
562 }
563
564
565 /*
566  *      Unix accounting - write a wtmp file.
567  */
568 static int unix_accounting(void *instance, REQUEST *request)
569 {
570         VALUE_PAIR      *vp;
571         NAS             *cl;
572         FILE            *fp;
573         struct utmp     ut;
574         time_t          t;
575         char            buf[64];
576         const char      *s;
577         int             delay = 0;
578         int             status = -1;
579         int             nas_address = 0;
580         int             framed_address = 0;
581         int             protocol = -1;
582         int             nas_port = 0;
583         int             port_seen = 0;
584         int             nas_port_type = 0;
585         struct unix_instance *inst = (struct unix_instance *) instance;
586
587         /*
588          *      Which type is this.
589          */
590         if ((vp = pairfind(request->packet->vps, PW_ACCT_STATUS_TYPE))==NULL) {
591                 radlog(L_ERR, "Accounting: no Accounting-Status-Type record.");
592                 return RLM_MODULE_NOOP;
593         }
594         status = vp->lvalue;
595
596         /*
597          *      FIXME: handle PW_STATUS_ALIVE like 1.5.4.3 did.
598          */
599         if (status != PW_STATUS_START &&
600             status != PW_STATUS_STOP)
601                 return RLM_MODULE_NOOP;
602
603         /*
604          *      We're only interested in accounting messages
605          *      with a username in it.
606          */
607         if ((vp = pairfind(request->packet->vps, PW_USER_NAME)) == NULL)
608                 return RLM_MODULE_NOOP;
609
610         t = request->timestamp;
611         memset(&ut, 0, sizeof(ut));
612
613         /*
614          *      First, find the interesting attributes.
615          */
616         for (vp = request->packet->vps; vp; vp = vp->next) {
617                 switch (vp->attribute) {
618                         case PW_USER_NAME:
619                                 if (vp->length >= sizeof(ut.ut_name)) {
620                                         memcpy(ut.ut_name, (char *)vp->strvalue, sizeof(ut.ut_name));
621                                 } else {
622                                         strNcpy(ut.ut_name, (char *)vp->strvalue, sizeof(ut.ut_name));
623                                 }
624                                 break;
625                         case PW_LOGIN_IP_HOST:
626                         case PW_FRAMED_IP_ADDRESS:
627                                 framed_address = vp->lvalue;
628                                 break;
629                         case PW_FRAMED_PROTOCOL:
630                                 protocol = vp->lvalue;
631                                 break;
632                         case PW_NAS_IP_ADDRESS:
633                                 nas_address = vp->lvalue;
634                                 break;
635                         case PW_NAS_PORT_ID:
636                                 nas_port = vp->lvalue;
637                                 port_seen = 1;
638                                 break;
639                         case PW_ACCT_DELAY_TIME:
640                                 delay = vp->lvalue;
641                                 break;
642                         case PW_NAS_PORT_TYPE:
643                                 nas_port_type = vp->lvalue;
644                                 break;
645                 }
646         }
647
648         /*
649          *      We don't store !root sessions, or sessions
650          *      where we didn't see a PW_NAS_PORT_ID.
651          */
652         if (strncmp(ut.ut_name, "!root", sizeof(ut.ut_name)) == 0 || !port_seen)
653                 return RLM_MODULE_NOOP;
654
655         /*
656          *      If we didn't find out the NAS address, use the
657          *      originator's IP address.
658          */
659         if (nas_address == 0)
660                 nas_address = request->packet->src_ipaddr;
661
662 #ifdef __linux__
663         /*
664          *      Linux has a field for the client address.
665          */
666         ut.ut_addr = framed_address;
667 #endif
668         /*
669          *      We use the tty field to store the terminal servers' port
670          *      and address so that the tty field is unique.
671          */
672         s = "";
673         if ((cl = nas_find(nas_address)) != NULL)
674                 s = cl->shortname;
675         if (s == NULL || s[0] == 0) s = uue(&(nas_address));
676         sprintf(buf, "%03d:%s", nas_port, s);
677         strNcpy(ut.ut_line, buf, sizeof(ut.ut_line));
678
679         /*
680          *      We store the dynamic IP address in the hostname field.
681          */
682 #ifdef UT_HOSTSIZE
683         if (framed_address) {
684                 ip_ntoa(buf, framed_address);
685                 strncpy(ut.ut_host, buf, UT_HOSTSIZE);
686         }
687 #endif
688 #ifdef HAVE_UTMPX_H
689         ut.ut_xtime = t- delay;
690 #else
691         ut.ut_time = t - delay;
692 #endif
693 #ifdef USER_PROCESS
694         /*
695          *      And we can use the ID field to store
696          *      the protocol.
697          */
698         if (protocol == PW_PPP)
699                 strcpy(ut.ut_id, "P");
700         else if (protocol == PW_SLIP)
701                 strcpy(ut.ut_id, "S");
702         else
703                 strcpy(ut.ut_id, "T");
704         ut.ut_type = status == PW_STATUS_STOP ? DEAD_PROCESS : USER_PROCESS;
705 #endif
706         if (status == PW_STATUS_STOP)
707                 ut.ut_name[0] = 0;
708
709         /*
710          *      Write a RADIUS wtmp log file.
711          *
712          *      Try to open the file if we can't, we don't write the
713          *      wtmp file. If we can try to write. If we fail,
714          *      return RLM_MODULE_FAIL ..
715          */
716         if ((fp = fopen(inst->radwtmp, "a")) != NULL) {
717                 if ((fwrite(&ut, sizeof(ut), 1, fp)) != 1) {
718                         fclose(fp);
719                         return RLM_MODULE_FAIL;
720                 }
721                 fclose(fp);
722         } else 
723                 return RLM_MODULE_FAIL;
724
725         return RLM_MODULE_OK;
726 }
727
728 /* globally exported name */
729 module_t rlm_unix = {
730   "System",
731   RLM_TYPE_THREAD_UNSAFE,        /* type: reserved */
732   unix_init,                    /* initialization */
733   unix_instantiate,             /* instantiation */
734   {
735           unix_authenticate,    /* authentication */
736           NULL,                 /* authorization */
737           NULL,                 /* preaccounting */
738           unix_accounting,      /* accounting */
739           NULL                  /* checksimul */
740   },
741   unix_detach,                  /* detach */
742   unix_destroy,                  /* destroy */
743 };
744