Annotation of src/usr.bin/ssh/auth2.c, Revision 1.22
1.1 markus 1: /*
2: * Copyright (c) 2000 Markus Friedl. All rights reserved.
3: *
4: * Redistribution and use in source and binary forms, with or without
5: * modification, are permitted provided that the following conditions
6: * are met:
7: * 1. Redistributions of source code must retain the above copyright
8: * notice, this list of conditions and the following disclaimer.
9: * 2. Redistributions in binary form must reproduce the above copyright
10: * notice, this list of conditions and the following disclaimer in the
11: * documentation and/or other materials provided with the distribution.
12: *
13: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23: */
1.14 deraadt 24:
1.1 markus 25: #include "includes.h"
1.22 ! markus 26: RCSID("$OpenBSD: auth2.c,v 1.21 2000/11/12 19:50:37 markus Exp $");
1.1 markus 27:
28: #include <openssl/dsa.h>
29: #include <openssl/rsa.h>
30: #include <openssl/evp.h>
31:
32: #include "xmalloc.h"
33: #include "rsa.h"
34: #include "ssh.h"
35: #include "pty.h"
36: #include "packet.h"
37: #include "buffer.h"
38: #include "servconf.h"
39: #include "compat.h"
40: #include "channels.h"
41: #include "bufaux.h"
42: #include "ssh2.h"
43: #include "auth.h"
44: #include "session.h"
45: #include "dispatch.h"
46: #include "auth.h"
47: #include "key.h"
48: #include "kex.h"
49:
50: #include "uidswap.h"
1.10 markus 51: #include "auth-options.h"
1.1 markus 52:
53: /* import */
54: extern ServerOptions options;
55: extern unsigned char *session_id2;
56: extern int session_id2_len;
57:
1.18 markus 58: static Authctxt *x_authctxt = NULL;
59: static int one = 1;
60:
61: typedef struct Authmethod Authmethod;
62: struct Authmethod {
63: char *name;
64: int (*userauth)(Authctxt *authctxt);
65: int *enabled;
66: };
67:
1.1 markus 68: /* protocol */
69:
1.15 markus 70: void input_service_request(int type, int plen, void *ctxt);
71: void input_userauth_request(int type, int plen, void *ctxt);
72: void protocol_error(int type, int plen, void *ctxt);
1.1 markus 73:
74:
75: /* helper */
1.18 markus 76: Authmethod *authmethod_lookup(const char *name);
77: struct passwd *pwcopy(struct passwd *pw);
1.21 markus 78: int user_key_allowed(struct passwd *pw, Key *key);
1.18 markus 79: char *authmethods_get(void);
1.1 markus 80:
1.18 markus 81: /* auth */
82: int userauth_none(Authctxt *authctxt);
83: int userauth_passwd(Authctxt *authctxt);
84: int userauth_pubkey(Authctxt *authctxt);
85: int userauth_kbdint(Authctxt *authctxt);
86:
87: Authmethod authmethods[] = {
88: {"none",
89: userauth_none,
90: &one},
91: {"publickey",
92: userauth_pubkey,
1.21 markus 93: &options.pubkey_authentication},
1.18 markus 94: {"keyboard-interactive",
95: userauth_kbdint,
96: &options.kbd_interactive_authentication},
97: {"password",
98: userauth_passwd,
99: &options.password_authentication},
100: {NULL, NULL, NULL}
1.1 markus 101: };
102:
103: /*
1.18 markus 104: * loop until authctxt->success == TRUE
1.1 markus 105: */
106:
107: void
108: do_authentication2()
109: {
1.18 markus 110: Authctxt *authctxt = xmalloc(sizeof(*authctxt));
111: memset(authctxt, 'a', sizeof(*authctxt));
112: authctxt->valid = 0;
113: authctxt->attempt = 0;
114: authctxt->success = 0;
115: x_authctxt = authctxt; /*XXX*/
116:
1.5 djm 117: #ifdef KRB4
1.18 markus 118: /* turn off kerberos, not supported by SSH2 */
1.4 markus 119: options.kerberos_authentication = 0;
1.5 djm 120: #endif
1.1 markus 121: dispatch_init(&protocol_error);
122: dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request);
1.18 markus 123: dispatch_run(DISPATCH_BLOCK, &authctxt->success, authctxt);
1.1 markus 124: do_authenticated2();
125: }
126:
127: void
1.15 markus 128: protocol_error(int type, int plen, void *ctxt)
1.1 markus 129: {
130: log("auth: protocol error: type %d plen %d", type, plen);
131: packet_start(SSH2_MSG_UNIMPLEMENTED);
132: packet_put_int(0);
133: packet_send();
134: packet_write_wait();
135: }
136:
137: void
1.15 markus 138: input_service_request(int type, int plen, void *ctxt)
1.1 markus 139: {
1.18 markus 140: Authctxt *authctxt = ctxt;
1.1 markus 141: unsigned int len;
142: int accept = 0;
143: char *service = packet_get_string(&len);
144: packet_done();
145:
1.18 markus 146: if (authctxt == NULL)
147: fatal("input_service_request: no authctxt");
148:
1.1 markus 149: if (strcmp(service, "ssh-userauth") == 0) {
1.18 markus 150: if (!authctxt->success) {
1.1 markus 151: accept = 1;
152: /* now we can handle user-auth requests */
153: dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &input_userauth_request);
154: }
155: }
156: /* XXX all other service requests are denied */
157:
158: if (accept) {
159: packet_start(SSH2_MSG_SERVICE_ACCEPT);
160: packet_put_cstring(service);
161: packet_send();
162: packet_write_wait();
163: } else {
164: debug("bad service request %s", service);
165: packet_disconnect("bad service request %s", service);
166: }
167: xfree(service);
168: }
169:
170: void
1.15 markus 171: input_userauth_request(int type, int plen, void *ctxt)
1.1 markus 172: {
1.18 markus 173: Authctxt *authctxt = ctxt;
174: Authmethod *m = NULL;
175: char *user, *service, *method;
1.1 markus 176: int authenticated = 0;
177:
1.18 markus 178: if (authctxt == NULL)
179: fatal("input_userauth_request: no authctxt");
180: if (authctxt->attempt++ >= AUTH_FAIL_MAX)
1.1 markus 181: packet_disconnect("too many failed userauth_requests");
182:
1.18 markus 183: user = packet_get_string(NULL);
184: service = packet_get_string(NULL);
185: method = packet_get_string(NULL);
1.1 markus 186: debug("userauth-request for user %s service %s method %s", user, service, method);
1.18 markus 187: debug("attempt #%d", authctxt->attempt);
1.1 markus 188:
1.18 markus 189: if (authctxt->attempt == 1) {
190: /* setup auth context */
191: struct passwd *pw = NULL;
192: setproctitle("%s", user);
193: pw = getpwnam(user);
194: if (pw && allowed_user(pw) && strcmp(service, "ssh-connection")==0) {
195: authctxt->pw = pwcopy(pw);
196: authctxt->valid = 1;
197: debug2("input_userauth_request: setting up authctxt for %s", user);
198: } else {
199: log("input_userauth_request: illegal user %s", user);
200: }
201: authctxt->user = xstrdup(user);
202: authctxt->service = xstrdup(service);
203: } else if (authctxt->valid) {
204: if (strcmp(user, authctxt->user) != 0 ||
205: strcmp(service, authctxt->service) != 0) {
206: log("input_userauth_request: missmatch: (%s,%s)!=(%s,%s)",
207: user, service, authctxt->user, authctxt->service);
208: authctxt->valid = 0;
1.1 markus 209: }
210: }
1.18 markus 211:
212: m = authmethod_lookup(method);
213: if (m != NULL) {
214: debug2("input_userauth_request: try method %s", method);
215: authenticated = m->userauth(authctxt);
216: } else {
217: debug2("input_userauth_request: unsupported method %s", method);
218: }
219: if (!authctxt->valid && authenticated == 1) {
220: log("input_userauth_request: INTERNAL ERROR: authenticated invalid user %s service %s", user, method);
221: authenticated = 0;
222: }
223:
224: /* Special handling for root */
225: if (authenticated == 1 &&
226: authctxt->valid && authctxt->pw->pw_uid == 0 && !options.permit_root_login) {
1.3 markus 227: authenticated = 0;
1.18 markus 228: log("ROOT LOGIN REFUSED FROM %.200s", get_canonical_hostname());
1.3 markus 229: }
230:
1.18 markus 231: /* Log before sending the reply */
232: userauth_log(authctxt, authenticated, method);
233: userauth_reply(authctxt, authenticated);
234:
235: xfree(service);
236: xfree(user);
237: xfree(method);
238: }
239:
240:
241: void
242: userauth_log(Authctxt *authctxt, int authenticated, char *method)
243: {
244: void (*authlog) (const char *fmt,...) = verbose;
245: char *user = NULL, *authmsg = NULL;
246:
1.6 markus 247: /* Raise logging level */
248: if (authenticated == 1 ||
1.18 markus 249: !authctxt->valid ||
250: authctxt->attempt >= AUTH_FAIL_LOG ||
1.6 markus 251: strcmp(method, "password") == 0)
252: authlog = log;
253:
254: if (authenticated == 1) {
255: authmsg = "Accepted";
256: } else if (authenticated == 0) {
257: authmsg = "Failed";
258: } else {
259: authmsg = "Postponed";
260: }
1.18 markus 261:
262: if (authctxt->valid) {
263: user = authctxt->pw->pw_uid == 0 ? "ROOT" : authctxt->user;
264: } else {
265: user = "NOUSER";
266: }
267:
1.6 markus 268: authlog("%s %s for %.200s from %.200s port %d ssh2",
1.18 markus 269: authmsg,
270: method,
271: user,
272: get_remote_ipaddr(),
273: get_remote_port());
274: }
1.6 markus 275:
1.18 markus 276: void
277: userauth_reply(Authctxt *authctxt, int authenticated)
278: {
1.3 markus 279: /* XXX todo: check if multiple auth methods are needed */
1.1 markus 280: if (authenticated == 1) {
281: /* turn off userauth */
282: dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &protocol_error);
283: packet_start(SSH2_MSG_USERAUTH_SUCCESS);
284: packet_send();
285: packet_write_wait();
286: /* now we can break out */
1.18 markus 287: authctxt->success = 1;
1.1 markus 288: } else if (authenticated == 0) {
1.18 markus 289: char *methods = authmethods_get();
1.1 markus 290: packet_start(SSH2_MSG_USERAUTH_FAILURE);
1.18 markus 291: packet_put_cstring(methods);
292: packet_put_char(0); /* XXX partial success, unused */
1.1 markus 293: packet_send();
294: packet_write_wait();
1.18 markus 295: xfree(methods);
296: } else {
297: /* do nothing, we did already send a reply */
1.1 markus 298: }
299: }
300:
301: int
1.18 markus 302: userauth_none(Authctxt *authctxt)
1.1 markus 303: {
1.18 markus 304: /* disable method "none", only allowed one time */
305: Authmethod *m = authmethod_lookup("none");
306: if (m != NULL)
307: m->enabled = NULL;
1.1 markus 308: packet_done();
1.18 markus 309: return authctxt->valid ? auth_password(authctxt->pw, "") : 0;
1.1 markus 310: }
1.18 markus 311:
1.1 markus 312: int
1.18 markus 313: userauth_passwd(Authctxt *authctxt)
1.1 markus 314: {
315: char *password;
316: int authenticated = 0;
317: int change;
318: unsigned int len;
319: change = packet_get_char();
320: if (change)
321: log("password change not supported");
322: password = packet_get_string(&len);
323: packet_done();
1.18 markus 324: if (authctxt->valid &&
325: auth_password(authctxt->pw, password) == 1)
1.1 markus 326: authenticated = 1;
327: memset(password, 0, len);
328: xfree(password);
329: return authenticated;
330: }
1.18 markus 331:
332: int
333: userauth_kbdint(Authctxt *authctxt)
334: {
335: int authenticated = 0;
336: char *lang = NULL;
337: char *devs = NULL;
338:
339: lang = packet_get_string(NULL);
340: devs = packet_get_string(NULL);
341: packet_done();
342:
343: debug("keyboard-interactive language %s devs %s", lang, devs);
344: #ifdef SKEY
345: /* XXX hardcoded, we should look at devs */
346: if (options.skey_authentication != 0)
347: authenticated = auth2_skey(authctxt);
348: #endif
349: xfree(lang);
350: xfree(devs);
351: return authenticated;
352: }
353:
1.1 markus 354: int
1.18 markus 355: userauth_pubkey(Authctxt *authctxt)
1.1 markus 356: {
357: Buffer b;
358: Key *key;
359: char *pkalg, *pkblob, *sig;
360: unsigned int alen, blen, slen;
1.21 markus 361: int have_sig, pktype;
1.1 markus 362: int authenticated = 0;
363:
1.18 markus 364: if (!authctxt->valid) {
365: debug2("userauth_pubkey: disabled because of invalid user");
1.8 markus 366: return 0;
367: }
1.1 markus 368: have_sig = packet_get_char();
1.22 ! markus 369: if (datafellows & SSH_BUG_PKAUTH) {
! 370: debug2("userauth_pubkey: SSH_BUG_PKAUTH");
! 371: /* no explicit pkalg given */
! 372: pkblob = packet_get_string(&blen);
! 373: buffer_init(&b);
! 374: buffer_append(&b, pkblob, blen);
! 375: /* so we have to extract the pkalg from the pkblob */
! 376: pkalg = buffer_get_string(&b, &alen);
! 377: buffer_free(&b);
! 378: } else {
! 379: pkalg = packet_get_string(&alen);
! 380: pkblob = packet_get_string(&blen);
! 381: }
1.21 markus 382: pktype = key_type_from_name(pkalg);
383: if (pktype == KEY_UNSPEC) {
1.22 ! markus 384: /* this is perfectly legal */
! 385: log("userauth_pubkey: unsupported public key algorithm: %s", pkalg);
1.1 markus 386: xfree(pkalg);
1.22 ! markus 387: xfree(pkblob);
1.1 markus 388: return 0;
389: }
1.21 markus 390: key = key_from_blob(pkblob, blen);
1.2 markus 391: if (key != NULL) {
392: if (have_sig) {
393: sig = packet_get_string(&slen);
394: packet_done();
395: buffer_init(&b);
1.20 markus 396: if (datafellows & SSH_OLD_SESSIONID) {
397: buffer_append(&b, session_id2, session_id2_len);
398: } else {
1.11 markus 399: buffer_put_string(&b, session_id2, session_id2_len);
400: }
1.9 markus 401: /* reconstruct packet */
1.2 markus 402: buffer_put_char(&b, SSH2_MSG_USERAUTH_REQUEST);
1.18 markus 403: buffer_put_cstring(&b, authctxt->user);
1.9 markus 404: buffer_put_cstring(&b,
1.22 ! markus 405: datafellows & SSH_BUG_PKSERVICE ?
1.9 markus 406: "ssh-userauth" :
1.18 markus 407: authctxt->service);
1.22 ! markus 408: if (datafellows & SSH_BUG_PKAUTH) {
! 409: buffer_put_char(&b, have_sig);
! 410: } else {
! 411: buffer_put_cstring(&b, "publickey");
! 412: buffer_put_char(&b, have_sig);
! 413: buffer_put_cstring(&b, key_ssh_name(key));
! 414: }
1.9 markus 415: buffer_put_string(&b, pkblob, blen);
1.21 markus 416: #ifdef DEBUG_PK
1.2 markus 417: buffer_dump(&b);
1.1 markus 418: #endif
1.2 markus 419: /* test for correct signature */
1.21 markus 420: if (user_key_allowed(authctxt->pw, key) &&
421: key_verify(key, sig, slen, buffer_ptr(&b), buffer_len(&b)) == 1)
1.2 markus 422: authenticated = 1;
423: buffer_clear(&b);
424: xfree(sig);
425: } else {
1.18 markus 426: debug("test whether pkalg/pkblob are acceptable");
1.2 markus 427: packet_done();
1.18 markus 428:
1.2 markus 429: /* XXX fake reply and always send PK_OK ? */
1.6 markus 430: /*
431: * XXX this allows testing whether a user is allowed
432: * to login: if you happen to have a valid pubkey this
433: * message is sent. the message is NEVER sent at all
434: * if a user is not allowed to login. is this an
435: * issue? -markus
436: */
1.21 markus 437: if (user_key_allowed(authctxt->pw, key)) {
1.2 markus 438: packet_start(SSH2_MSG_USERAUTH_PK_OK);
439: packet_put_string(pkalg, alen);
440: packet_put_string(pkblob, blen);
441: packet_send();
442: packet_write_wait();
443: authenticated = -1;
444: }
1.1 markus 445: }
1.17 markus 446: if (authenticated != 1)
447: auth_clear_options();
1.2 markus 448: key_free(key);
1.1 markus 449: }
1.21 markus 450: debug2("userauth_pubkey: authenticated %d pkalg %s", authenticated, pkalg);
1.1 markus 451: xfree(pkalg);
452: xfree(pkblob);
453: return authenticated;
454: }
455:
1.18 markus 456: /* get current user */
1.1 markus 457:
458: struct passwd*
459: auth_get_user(void)
460: {
1.18 markus 461: return (x_authctxt != NULL && x_authctxt->valid) ? x_authctxt->pw : NULL;
1.1 markus 462: }
463:
1.18 markus 464: #define DELIM ","
465:
466: char *
467: authmethods_get(void)
1.1 markus 468: {
1.18 markus 469: Authmethod *method = NULL;
470: unsigned int size = 0;
471: char *list;
1.1 markus 472:
1.18 markus 473: for (method = authmethods; method->name != NULL; method++) {
474: if (strcmp(method->name, "none") == 0)
475: continue;
476: if (method->enabled != NULL && *(method->enabled) != 0) {
477: if (size != 0)
478: size += strlen(DELIM);
479: size += strlen(method->name);
1.1 markus 480: }
1.18 markus 481: }
482: size++; /* trailing '\0' */
483: list = xmalloc(size);
484: list[0] = '\0';
485:
486: for (method = authmethods; method->name != NULL; method++) {
487: if (strcmp(method->name, "none") == 0)
488: continue;
489: if (method->enabled != NULL && *(method->enabled) != 0) {
490: if (list[0] != '\0')
491: strlcat(list, DELIM, size);
492: strlcat(list, method->name, size);
1.1 markus 493: }
494: }
1.18 markus 495: return list;
496: }
497:
498: Authmethod *
499: authmethod_lookup(const char *name)
500: {
501: Authmethod *method = NULL;
502: if (name != NULL)
503: for (method = authmethods; method->name != NULL; method++)
504: if (method->enabled != NULL &&
505: *(method->enabled) != 0 &&
506: strcmp(name, method->name) == 0)
507: return method;
508: debug2("Unrecognized authentication method name: %s", name ? name : "NULL");
509: return NULL;
1.1 markus 510: }
511:
512: /* return 1 if user allows given key */
513: int
1.21 markus 514: user_key_allowed(struct passwd *pw, Key *key)
1.1 markus 515: {
516: char line[8192], file[1024];
517: int found_key = 0;
518: FILE *f;
519: unsigned long linenum = 0;
520: struct stat st;
521: Key *found;
522:
1.18 markus 523: if (pw == NULL)
524: return 0;
525:
1.1 markus 526: /* Temporarily use the user's uid. */
527: temporarily_use_uid(pw->pw_uid);
528:
529: /* The authorized keys. */
530: snprintf(file, sizeof file, "%.500s/%.100s", pw->pw_dir,
531: SSH_USER_PERMITTED_KEYS2);
532:
533: /* Fail quietly if file does not exist */
534: if (stat(file, &st) < 0) {
535: /* Restore the privileged uid. */
536: restore_uid();
537: return 0;
538: }
539: /* Open the file containing the authorized keys. */
540: f = fopen(file, "r");
541: if (!f) {
542: /* Restore the privileged uid. */
543: restore_uid();
544: return 0;
545: }
546: if (options.strict_modes) {
547: int fail = 0;
548: char buf[1024];
549: /* Check open file in order to avoid open/stat races */
550: if (fstat(fileno(f), &st) < 0 ||
551: (st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
552: (st.st_mode & 022) != 0) {
1.16 markus 553: snprintf(buf, sizeof buf,
554: "%s authentication refused for %.100s: "
555: "bad ownership or modes for '%s'.",
556: key_type(key), pw->pw_name, file);
1.1 markus 557: fail = 1;
558: } else {
559: /* Check path to SSH_USER_PERMITTED_KEYS */
560: int i;
561: static const char *check[] = {
562: "", SSH_USER_DIR, NULL
563: };
564: for (i = 0; check[i]; i++) {
565: snprintf(line, sizeof line, "%.500s/%.100s",
566: pw->pw_dir, check[i]);
567: if (stat(line, &st) < 0 ||
568: (st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
569: (st.st_mode & 022) != 0) {
570: snprintf(buf, sizeof buf,
1.16 markus 571: "%s authentication refused for %.100s: "
1.1 markus 572: "bad ownership or modes for '%s'.",
1.16 markus 573: key_type(key), pw->pw_name, line);
1.1 markus 574: fail = 1;
575: break;
576: }
577: }
578: }
579: if (fail) {
580: fclose(f);
1.12 todd 581: log("%s",buf);
1.1 markus 582: restore_uid();
583: return 0;
584: }
585: }
586: found_key = 0;
1.16 markus 587: found = key_new(key->type);
1.1 markus 588:
589: while (fgets(line, sizeof(line), f)) {
1.10 markus 590: char *cp, *options = NULL;
1.1 markus 591: linenum++;
592: /* Skip leading whitespace, empty and comment lines. */
593: for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
594: ;
595: if (!*cp || *cp == '\n' || *cp == '#')
596: continue;
1.10 markus 597:
1.21 markus 598: if (key_read(found, &cp) == -1) {
1.10 markus 599: /* no key? check if there are options for this key */
600: int quoted = 0;
1.21 markus 601: debug2("user_key_allowed: check options: '%s'", cp);
1.10 markus 602: options = cp;
603: for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) {
604: if (*cp == '\\' && cp[1] == '"')
605: cp++; /* Skip both */
606: else if (*cp == '"')
607: quoted = !quoted;
608: }
609: /* Skip remaining whitespace. */
610: for (; *cp == ' ' || *cp == '\t'; cp++)
611: ;
1.21 markus 612: if (key_read(found, &cp) == -1) {
613: debug2("user_key_allowed: advance: '%s'", cp);
1.10 markus 614: /* still no key? advance to next line*/
615: continue;
616: }
617: }
618: if (key_equal(found, key) &&
619: auth_parse_options(pw, options, linenum) == 1) {
1.1 markus 620: found_key = 1;
621: debug("matching key found: file %s, line %ld",
622: file, linenum);
623: break;
624: }
625: }
626: restore_uid();
627: fclose(f);
628: key_free(found);
629: return found_key;
1.18 markus 630: }
631:
632: struct passwd *
633: pwcopy(struct passwd *pw)
634: {
635: struct passwd *copy = xmalloc(sizeof(*copy));
636: memset(copy, 0, sizeof(*copy));
637: copy->pw_name = xstrdup(pw->pw_name);
638: copy->pw_passwd = xstrdup(pw->pw_passwd);
639: copy->pw_uid = pw->pw_uid;
640: copy->pw_gid = pw->pw_gid;
641: copy->pw_class = xstrdup(pw->pw_class);
642: copy->pw_dir = xstrdup(pw->pw_dir);
643: copy->pw_shell = xstrdup(pw->pw_shell);
644: return copy;
1.1 markus 645: }