No empty .Rs/.Re
[netbsd-mini2440.git] / usr.sbin / rpc.pcnfsd / pcnfsd_v1.c
blob7ef6ce0986be340a173c9b917bec5649f1f9d489
1 /* $NetBSD: pcnfsd_v1.c,v 1.2 1995/07/25 22:21:19 gwr Exp $ */
3 /* RE_SID: @(%)/usr/dosnfs/shades_SCCS/unix/pcnfsd/v2/src/SCCS/s.pcnfsd_v1.c 1.1 91/09/03 12:41:50 SMI */
4 /*
5 **=====================================================================
6 ** Copyright (c) 1986,1987,1988,1989,1990,1991 by Sun Microsystems, Inc.
7 ** @(#)pcnfsd_v1.c 1.1 9/3/91
8 **=====================================================================
9 */
11 **=====================================================================
12 ** I N C L U D E F I L E S E C T I O N *
13 ** *
14 ** If your port requires different include files, add a suitable *
15 ** #define in the customization section, and make the inclusion or *
16 ** exclusion of the files conditional on this. *
17 **=====================================================================
20 #include <sys/file.h>
21 #include <sys/ioctl.h>
22 #include <sys/stat.h>
24 #include <netdb.h>
25 #include <pwd.h>
26 #include <signal.h>
27 #include <stdio.h>
28 #include <string.h>
29 #include <unistd.h>
31 #ifndef SYSV
32 #include <sys/wait.h>
33 #endif
35 #ifdef ISC_2_0
36 #include <sys/fcntl.h>
37 #endif
39 #ifdef SHADOW_SUPPORT
40 #include <shadow.h>
41 #endif
43 #include "common.h"
44 #include "pcnfsd.h"
45 #include "extern.h"
48 **---------------------------------------------------------------------
49 ** Misc. variable definitions
50 **---------------------------------------------------------------------
53 int buggit = 0;
56 **=====================================================================
57 ** C O D E S E C T I O N *
58 **=====================================================================
62 /*ARGSUSED*/
63 void *
64 pcnfsd_null_1_svc(arg, req)
65 void *arg;
66 struct svc_req *req;
68 static char dummy;
69 return ((void *) &dummy);
72 auth_results *
73 pcnfsd_auth_1_svc(arg, req)
74 auth_args *arg;
75 struct svc_req *req;
77 static auth_results r;
79 char uname[32];
80 char pw[64];
81 int c1, c2;
82 struct passwd *p;
85 r.stat = AUTH_RES_FAIL; /* assume failure */
86 r.uid = (int) -2;
87 r.gid = (int) -2;
89 scramble(arg->id, uname);
90 scramble(arg->pw, pw);
92 #ifdef USER_CACHE
93 if (check_cache(uname, pw, &r.uid, &r.gid)) {
94 r.stat = AUTH_RES_OK;
95 #ifdef WTMP
96 wlogin(uname, req);
97 #endif
98 return (&r);
100 #endif
102 p = get_password(uname);
103 if (p == (struct passwd *) NULL)
104 return (&r);
106 c1 = strlen(pw);
107 c2 = strlen(p->pw_passwd);
108 if ((c1 && !c2) || (c2 && !c1) ||
109 (strcmp(p->pw_passwd, crypt(pw, p->pw_passwd)))) {
110 return (&r);
112 r.stat = AUTH_RES_OK;
113 r.uid = p->pw_uid;
114 r.gid = p->pw_gid;
115 #ifdef WTMP
116 wlogin(uname, req);
117 #endif
119 #ifdef USER_CACHE
120 add_cache_entry(p);
121 #endif
123 return (&r);
126 pr_init_results *
127 pcnfsd_pr_init_1_svc(pi_arg, req)
128 pr_init_args *pi_arg;
129 struct svc_req *req;
131 static pr_init_results pi_res;
133 pi_res.stat =
134 (pirstat) pr_init(pi_arg->system, pi_arg->pn, &pi_res.dir);
136 return (&pi_res);
139 pr_start_results *
140 pcnfsd_pr_start_1_svc(ps_arg, req)
141 pr_start_args *ps_arg;
142 struct svc_req *req;
144 static pr_start_results ps_res;
145 char *dummyptr;
147 ps_res.stat =
148 (psrstat) pr_start2(ps_arg->system, ps_arg->pn, ps_arg->user,
149 ps_arg->file, ps_arg->opts, &dummyptr);
151 return (&ps_res);