1 /* $NetBSD: auth.c,v 1.7 2013/03/29 16:19:44 christos Exp $ */ 2 /* $OpenBSD: auth.c,v 1.101 2013/02/06 00:22:21 dtucker Exp $ */ 3 /* 4 * Copyright (c) 2000 Markus Friedl. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 #include "includes.h" 28 __RCSID("$NetBSD: auth.c,v 1.7 2013/03/29 16:19:44 christos Exp $"); 29 #include <sys/types.h> 30 #include <sys/stat.h> 31 #include <sys/param.h> 32 33 #include <errno.h> 34 #include <fcntl.h> 35 #include <libgen.h> 36 #include <login_cap.h> 37 #include <paths.h> 38 #include <pwd.h> 39 #include <stdarg.h> 40 #include <stdio.h> 41 #include <string.h> 42 #include <unistd.h> 43 44 #include "xmalloc.h" 45 #include "match.h" 46 #include "groupaccess.h" 47 #include "log.h" 48 #include "buffer.h" 49 #include "servconf.h" 50 #include "key.h" 51 #include "hostfile.h" 52 #include "auth.h" 53 #include "auth-options.h" 54 #include "canohost.h" 55 #include "uidswap.h" 56 #include "misc.h" 57 #include "packet.h" 58 #ifdef GSSAPI 59 #include "ssh-gss.h" 60 #endif 61 #include "authfile.h" 62 #include "monitor_wrap.h" 63 #include "krl.h" 64 65 #ifdef HAVE_LOGIN_CAP 66 #include <login_cap.h> 67 #endif 68 69 /* import */ 70 extern ServerOptions options; 71 extern int use_privsep; 72 73 /* Debugging messages */ 74 Buffer auth_debug; 75 int auth_debug_init; 76 77 /* 78 * Check if the user is allowed to log in via ssh. If user is listed 79 * in DenyUsers or one of user's groups is listed in DenyGroups, false 80 * will be returned. If AllowUsers isn't empty and user isn't listed 81 * there, or if AllowGroups isn't empty and one of user's groups isn't 82 * listed there, false will be returned. 83 * If the user's shell is not executable, false will be returned. 84 * Otherwise true is returned. 85 */ 86 int 87 allowed_user(struct passwd * pw) 88 { 89 #ifdef HAVE_LOGIN_CAP 90 extern login_cap_t *lc; 91 int match_name, match_ip; 92 char *cap_hlist, *hp; 93 #endif 94 struct stat st; 95 const char *hostname = NULL, *ipaddr = NULL; 96 u_int i; 97 98 /* Shouldn't be called if pw is NULL, but better safe than sorry... */ 99 if (!pw || !pw->pw_name) 100 return 0; 101 102 #ifdef HAVE_LOGIN_CAP 103 hostname = get_canonical_hostname(1); 104 ipaddr = get_remote_ipaddr(); 105 106 lc = login_getclass(pw->pw_class); 107 108 /* 109 * Check the deny list. 110 */ 111 cap_hlist = login_getcapstr(lc, "host.deny", NULL, NULL); 112 if (cap_hlist != NULL) { 113 hp = strtok(cap_hlist, ","); 114 while (hp != NULL) { 115 match_name = match_hostname(hostname, 116 hp, strlen(hp)); 117 match_ip = match_hostname(ipaddr, 118 hp, strlen(hp)); 119 /* 120 * Only a positive match here causes a "deny". 121 */ 122 if (match_name > 0 || match_ip > 0) { 123 free(cap_hlist); 124 login_close(lc); 125 return 0; 126 } 127 hp = strtok(NULL, ","); 128 } 129 free(cap_hlist); 130 } 131 132 /* 133 * Check the allow list. If the allow list exists, and the 134 * remote host is not in it, the user is implicitly denied. 135 */ 136 cap_hlist = login_getcapstr(lc, "host.allow", NULL, NULL); 137 if (cap_hlist != NULL) { 138 hp = strtok(cap_hlist, ","); 139 if (hp == NULL) { 140 /* Just in case there's an empty string... */ 141 free(cap_hlist); 142 login_close(lc); 143 return 0; 144 } 145 while (hp != NULL) { 146 match_name = match_hostname(hostname, 147 hp, strlen(hp)); 148 match_ip = match_hostname(ipaddr, 149 hp, strlen(hp)); 150 /* 151 * Negative match causes an immediate "deny". 152 * Positive match causes us to break out 153 * of the loop (allowing a fallthrough). 154 */ 155 if (match_name < 0 || match_ip < 0) { 156 free(cap_hlist); 157 login_close(lc); 158 return 0; 159 } 160 if (match_name > 0 || match_ip > 0) 161 break; 162 hp = strtok(NULL, ","); 163 } 164 free(cap_hlist); 165 if (hp == NULL) { 166 login_close(lc); 167 return 0; 168 } 169 } 170 171 login_close(lc); 172 #endif 173 174 #ifdef USE_PAM 175 if (!options.use_pam) { 176 #endif 177 /* 178 * password/account expiration. 179 */ 180 if (pw->pw_change || pw->pw_expire) { 181 struct timeval tv; 182 183 (void)gettimeofday(&tv, (struct timezone *)NULL); 184 if (pw->pw_expire) { 185 if (tv.tv_sec >= pw->pw_expire) { 186 logit("User %.100s not allowed because account has expired", 187 pw->pw_name); 188 return 0; /* expired */ 189 } 190 } 191 #ifdef _PASSWORD_CHGNOW 192 if (pw->pw_change == _PASSWORD_CHGNOW) { 193 logit("User %.100s not allowed because password needs to be changed", 194 pw->pw_name); 195 196 return 0; /* can't force password change (yet) */ 197 } 198 #endif 199 if (pw->pw_change) { 200 if (tv.tv_sec >= pw->pw_change) { 201 logit("User %.100s not allowed because password has expired", 202 pw->pw_name); 203 return 0; /* expired */ 204 } 205 } 206 } 207 #ifdef USE_PAM 208 } 209 #endif 210 211 /* 212 * Deny if shell does not exist or is not executable unless we 213 * are chrooting. 214 */ 215 /* 216 * XXX Should check to see if it is executable by the 217 * XXX requesting user. --thorpej 218 */ 219 if (options.chroot_directory == NULL || 220 strcasecmp(options.chroot_directory, "none") == 0) { 221 char *shell = xstrdup((pw->pw_shell[0] == '\0') ? 222 _PATH_BSHELL : pw->pw_shell); /* empty = /bin/sh */ 223 224 if (stat(shell, &st) != 0) { 225 logit("User %.100s not allowed because shell %.100s " 226 "does not exist", pw->pw_name, shell); 227 xfree(shell); 228 return 0; 229 } 230 if (S_ISREG(st.st_mode) == 0 || 231 (st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP)) == 0) { 232 logit("User %.100s not allowed because shell %.100s " 233 "is not executable", pw->pw_name, shell); 234 xfree(shell); 235 return 0; 236 } 237 xfree(shell); 238 } 239 /* 240 * XXX Consider nuking {Allow,Deny}{Users,Groups}. We have the 241 * XXX login_cap(3) mechanism which covers all other types of 242 * XXX logins, too. 243 */ 244 245 if (options.num_deny_users > 0 || options.num_allow_users > 0 || 246 options.num_deny_groups > 0 || options.num_allow_groups > 0) { 247 hostname = get_canonical_hostname(options.use_dns); 248 ipaddr = get_remote_ipaddr(); 249 } 250 251 /* Return false if user is listed in DenyUsers */ 252 if (options.num_deny_users > 0) { 253 for (i = 0; i < options.num_deny_users; i++) 254 if (match_user(pw->pw_name, hostname, ipaddr, 255 options.deny_users[i])) { 256 logit("User %.100s from %.100s not allowed " 257 "because listed in DenyUsers", 258 pw->pw_name, hostname); 259 return 0; 260 } 261 } 262 /* Return false if AllowUsers isn't empty and user isn't listed there */ 263 if (options.num_allow_users > 0) { 264 for (i = 0; i < options.num_allow_users; i++) 265 if (match_user(pw->pw_name, hostname, ipaddr, 266 options.allow_users[i])) 267 break; 268 /* i < options.num_allow_users iff we break for loop */ 269 if (i >= options.num_allow_users) { 270 logit("User %.100s from %.100s not allowed because " 271 "not listed in AllowUsers", pw->pw_name, hostname); 272 return 0; 273 } 274 } 275 if (options.num_deny_groups > 0 || options.num_allow_groups > 0) { 276 /* Get the user's group access list (primary and supplementary) */ 277 if (ga_init(pw->pw_name, pw->pw_gid) == 0) { 278 logit("User %.100s from %.100s not allowed because " 279 "not in any group", pw->pw_name, hostname); 280 return 0; 281 } 282 283 /* Return false if one of user's groups is listed in DenyGroups */ 284 if (options.num_deny_groups > 0) 285 if (ga_match(options.deny_groups, 286 options.num_deny_groups)) { 287 ga_free(); 288 logit("User %.100s from %.100s not allowed " 289 "because a group is listed in DenyGroups", 290 pw->pw_name, hostname); 291 return 0; 292 } 293 /* 294 * Return false if AllowGroups isn't empty and one of user's groups 295 * isn't listed there 296 */ 297 if (options.num_allow_groups > 0) 298 if (!ga_match(options.allow_groups, 299 options.num_allow_groups)) { 300 ga_free(); 301 logit("User %.100s from %.100s not allowed " 302 "because none of user's groups are listed " 303 "in AllowGroups", pw->pw_name, hostname); 304 return 0; 305 } 306 ga_free(); 307 } 308 /* We found no reason not to let this user try to log on... */ 309 return 1; 310 } 311 312 void 313 auth_log(Authctxt *authctxt, int authenticated, int partial, 314 const char *method, const char *submethod, const char *info) 315 { 316 void (*authlog) (const char *fmt,...) = verbose; 317 const char *authmsg; 318 319 if (use_privsep && !mm_is_monitor() && !authctxt->postponed) 320 return; 321 322 /* Raise logging level */ 323 if (authenticated == 1 || 324 !authctxt->valid || 325 authctxt->failures >= options.max_authtries / 2 || 326 strcmp(method, "password") == 0) 327 authlog = logit; 328 329 if (authctxt->postponed) 330 authmsg = "Postponed"; 331 else if (partial) 332 authmsg = "Partial"; 333 else 334 authmsg = authenticated ? "Accepted" : "Failed"; 335 336 authlog("%s %s%s%s for %s%.100s from %.200s port %d%s", 337 authmsg, 338 method, 339 submethod != NULL ? "/" : "", submethod == NULL ? "" : submethod, 340 authctxt->valid ? "" : "invalid user ", 341 authctxt->user, 342 get_remote_ipaddr(), 343 get_remote_port(), 344 info); 345 } 346 347 /* 348 * Check whether root logins are disallowed. 349 */ 350 int 351 auth_root_allowed(const char *method) 352 { 353 switch (options.permit_root_login) { 354 case PERMIT_YES: 355 return 1; 356 case PERMIT_NO_PASSWD: 357 if (strcmp(method, "password") != 0) 358 return 1; 359 break; 360 case PERMIT_FORCED_ONLY: 361 if (forced_command) { 362 logit("Root login accepted for forced command."); 363 return 1; 364 } 365 break; 366 } 367 logit("ROOT LOGIN REFUSED FROM %.200s", get_remote_ipaddr()); 368 return 0; 369 } 370 371 372 /* 373 * Given a template and a passwd structure, build a filename 374 * by substituting % tokenised options. Currently, %% becomes '%', 375 * %h becomes the home directory and %u the username. 376 * 377 * This returns a buffer allocated by xmalloc. 378 */ 379 char * 380 expand_authorized_keys(const char *filename, struct passwd *pw) 381 { 382 char *file, ret[MAXPATHLEN]; 383 int i; 384 385 file = percent_expand(filename, "h", pw->pw_dir, 386 "u", pw->pw_name, (char *)NULL); 387 388 /* 389 * Ensure that filename starts anchored. If not, be backward 390 * compatible and prepend the '%h/' 391 */ 392 if (*file == '/') 393 return (file); 394 395 i = snprintf(ret, sizeof(ret), "%s/%s", pw->pw_dir, file); 396 if (i < 0 || (size_t)i >= sizeof(ret)) 397 fatal("expand_authorized_keys: path too long"); 398 xfree(file); 399 return (xstrdup(ret)); 400 } 401 402 char * 403 authorized_principals_file(struct passwd *pw) 404 { 405 if (options.authorized_principals_file == NULL || 406 strcasecmp(options.authorized_principals_file, "none") == 0) 407 return NULL; 408 return expand_authorized_keys(options.authorized_principals_file, pw); 409 } 410 411 /* return ok if key exists in sysfile or userfile */ 412 HostStatus 413 check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, 414 const char *sysfile, const char *userfile) 415 { 416 char *user_hostfile; 417 struct stat st; 418 HostStatus host_status; 419 struct hostkeys *hostkeys; 420 const struct hostkey_entry *found; 421 422 hostkeys = init_hostkeys(); 423 load_hostkeys(hostkeys, host, sysfile); 424 if (userfile != NULL) { 425 user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); 426 if (options.strict_modes && 427 (stat(user_hostfile, &st) == 0) && 428 ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || 429 (st.st_mode & 022) != 0)) { 430 logit("Authentication refused for %.100s: " 431 "bad owner or modes for %.200s", 432 pw->pw_name, user_hostfile); 433 auth_debug_add("Ignored %.200s: bad ownership or modes", 434 user_hostfile); 435 } else { 436 temporarily_use_uid(pw); 437 load_hostkeys(hostkeys, host, user_hostfile); 438 restore_uid(); 439 } 440 xfree(user_hostfile); 441 } 442 host_status = check_key_in_hostkeys(hostkeys, key, &found); 443 if (host_status == HOST_REVOKED) 444 error("WARNING: revoked key for %s attempted authentication", 445 found->host); 446 else if (host_status == HOST_OK) 447 debug("%s: key for %s found at %s:%ld", __func__, 448 found->host, found->file, found->line); 449 else 450 debug("%s: key for host %s not found", __func__, host); 451 452 free_hostkeys(hostkeys); 453 454 return host_status; 455 } 456 457 /* 458 * Check a given path for security. This is defined as all components 459 * of the path to the file must be owned by either the owner of 460 * of the file or root and no directories must be group or world writable. 461 * 462 * XXX Should any specific check be done for sym links ? 463 * 464 * Takes a file name, its stat information (preferably from fstat() to 465 * avoid races), the uid of the expected owner, their home directory and an 466 * error buffer plus max size as arguments. 467 * 468 * Returns 0 on success and -1 on failure 469 */ 470 int 471 auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, 472 uid_t uid, char *err, size_t errlen) 473 { 474 char buf[MAXPATHLEN], homedir[MAXPATHLEN]; 475 char *cp; 476 int comparehome = 0; 477 struct stat st; 478 479 if (realpath(name, buf) == NULL) { 480 snprintf(err, errlen, "realpath %s failed: %s", name, 481 strerror(errno)); 482 return -1; 483 } 484 if (pw_dir != NULL && realpath(pw_dir, homedir) != NULL) 485 comparehome = 1; 486 487 if (!S_ISREG(stp->st_mode)) { 488 snprintf(err, errlen, "%s is not a regular file", buf); 489 return -1; 490 } 491 if ((stp->st_uid != 0 && stp->st_uid != uid) || 492 (stp->st_mode & 022) != 0) { 493 snprintf(err, errlen, "bad ownership or modes for file %s", 494 buf); 495 return -1; 496 } 497 498 /* for each component of the canonical path, walking upwards */ 499 for (;;) { 500 if ((cp = dirname(buf)) == NULL) { 501 snprintf(err, errlen, "dirname() failed"); 502 return -1; 503 } 504 strlcpy(buf, cp, sizeof(buf)); 505 506 if (stat(buf, &st) < 0 || 507 (st.st_uid != 0 && st.st_uid != uid) || 508 (st.st_mode & 022) != 0) { 509 snprintf(err, errlen, 510 "bad ownership or modes for directory %s", buf); 511 return -1; 512 } 513 514 /* If are past the homedir then we can stop */ 515 if (comparehome && strcmp(homedir, buf) == 0) 516 break; 517 518 /* 519 * dirname should always complete with a "/" path, 520 * but we can be paranoid and check for "." too 521 */ 522 if ((strcmp("/", buf) == 0) || (strcmp(".", buf) == 0)) 523 break; 524 } 525 return 0; 526 } 527 528 /* 529 * Version of secure_path() that accepts an open file descriptor to 530 * avoid races. 531 * 532 * Returns 0 on success and -1 on failure 533 */ 534 static int 535 secure_filename(FILE *f, const char *file, struct passwd *pw, 536 char *err, size_t errlen) 537 { 538 struct stat st; 539 540 /* check the open file to avoid races */ 541 if (fstat(fileno(f), &st) < 0) { 542 snprintf(err, errlen, "cannot stat file %s: %s", 543 file, strerror(errno)); 544 return -1; 545 } 546 return auth_secure_path(file, &st, pw->pw_dir, pw->pw_uid, err, errlen); 547 } 548 549 static FILE * 550 auth_openfile(const char *file, struct passwd *pw, int strict_modes, 551 int log_missing, const char *file_type) 552 { 553 char line[1024]; 554 struct stat st; 555 int fd; 556 FILE *f; 557 558 if ((fd = open(file, O_RDONLY|O_NONBLOCK)) == -1) { 559 if (log_missing || errno != ENOENT) 560 debug("Could not open %s '%s': %s", file_type, file, 561 strerror(errno)); 562 return NULL; 563 } 564 565 if (fstat(fd, &st) < 0) { 566 close(fd); 567 return NULL; 568 } 569 if (!S_ISREG(st.st_mode)) { 570 logit("User %s %s %s is not a regular file", 571 pw->pw_name, file_type, file); 572 close(fd); 573 return NULL; 574 } 575 unset_nonblock(fd); 576 if ((f = fdopen(fd, "r")) == NULL) { 577 close(fd); 578 return NULL; 579 } 580 if (strict_modes && 581 secure_filename(f, file, pw, line, sizeof(line)) != 0) { 582 fclose(f); 583 logit("Authentication refused: %s", line); 584 auth_debug_add("Ignored %s: %s", file_type, line); 585 return NULL; 586 } 587 588 return f; 589 } 590 591 592 FILE * 593 auth_openkeyfile(const char *file, struct passwd *pw, int strict_modes) 594 { 595 return auth_openfile(file, pw, strict_modes, 1, "authorized keys"); 596 } 597 598 FILE * 599 auth_openprincipals(const char *file, struct passwd *pw, int strict_modes) 600 { 601 return auth_openfile(file, pw, strict_modes, 0, 602 "authorized principals"); 603 } 604 605 struct passwd * 606 getpwnamallow(const char *user) 607 { 608 #ifdef HAVE_LOGIN_CAP 609 extern login_cap_t *lc; 610 #ifdef BSD_AUTH 611 auth_session_t *as; 612 #endif 613 #endif 614 struct passwd *pw; 615 struct connection_info *ci = get_connection_info(1, options.use_dns); 616 617 ci->user = user; 618 parse_server_match_config(&options, ci); 619 620 pw = getpwnam(user); 621 if (pw == NULL) { 622 logit("Invalid user %.100s from %.100s", 623 user, get_remote_ipaddr()); 624 return (NULL); 625 } 626 if (!allowed_user(pw)) 627 return (NULL); 628 #ifdef HAVE_LOGIN_CAP 629 if ((lc = login_getclass(pw->pw_class)) == NULL) { 630 debug("unable to get login class: %s", user); 631 return (NULL); 632 } 633 #ifdef BSD_AUTH 634 if ((as = auth_open()) == NULL || auth_setpwd(as, pw) != 0 || 635 auth_approval(as, lc, pw->pw_name, "ssh") <= 0) { 636 debug("Approval failure for %s", user); 637 pw = NULL; 638 } 639 if (as != NULL) 640 auth_close(as); 641 #endif 642 #endif 643 if (pw != NULL) 644 return (pwcopy(pw)); 645 return (NULL); 646 } 647 648 /* Returns 1 if key is revoked by revoked_keys_file, 0 otherwise */ 649 int 650 auth_key_is_revoked(Key *key) 651 { 652 char *key_fp; 653 654 if (options.revoked_keys_file == NULL) 655 return 0; 656 switch (ssh_krl_file_contains_key(options.revoked_keys_file, key)) { 657 case 0: 658 return 0; /* Not revoked */ 659 case -2: 660 break; /* Not a KRL */ 661 default: 662 goto revoked; 663 } 664 debug3("%s: treating %s as a key list", __func__, 665 options.revoked_keys_file); 666 switch (key_in_file(key, options.revoked_keys_file, 0)) { 667 case 0: 668 /* key not revoked */ 669 return 0; 670 case -1: 671 /* Error opening revoked_keys_file: refuse all keys */ 672 error("Revoked keys file is unreadable: refusing public key " 673 "authentication"); 674 return 1; 675 case 1: 676 revoked: 677 /* Key revoked */ 678 key_fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); 679 error("WARNING: authentication attempt with a revoked " 680 "%s key %s ", key_type(key), key_fp); 681 xfree(key_fp); 682 return 1; 683 } 684 fatal("key_in_file returned junk"); 685 } 686 687 void 688 auth_debug_add(const char *fmt,...) 689 { 690 char buf[1024]; 691 va_list args; 692 693 if (!auth_debug_init) 694 return; 695 696 va_start(args, fmt); 697 vsnprintf(buf, sizeof(buf), fmt, args); 698 va_end(args); 699 buffer_put_cstring(&auth_debug, buf); 700 } 701 702 void 703 auth_debug_send(void) 704 { 705 char *msg; 706 707 if (!auth_debug_init) 708 return; 709 while (buffer_len(&auth_debug)) { 710 msg = buffer_get_string(&auth_debug, NULL); 711 packet_send_debug("%s", msg); 712 xfree(msg); 713 } 714 } 715 716 void 717 auth_debug_reset(void) 718 { 719 if (auth_debug_init) 720 buffer_clear(&auth_debug); 721 else { 722 buffer_init(&auth_debug); 723 auth_debug_init = 1; 724 } 725 } 726 727 struct passwd * 728 fakepw(void) 729 { 730 static struct passwd fake; 731 static char nouser[] = "NOUSER"; 732 static char nonexist[] = "/nonexist"; 733 734 memset(&fake, 0, sizeof(fake)); 735 fake.pw_name = nouser; 736 fake.pw_passwd = __UNCONST( 737 "$2a$06$r3.juUaHZDlIbQaO2dS9FuYxL1W9M81R1Tc92PoSNmzvpEqLkLGrK"); 738 fake.pw_gecos = nouser; 739 fake.pw_uid = (uid_t)-1; 740 fake.pw_gid = (gid_t)-1; 741 fake.pw_class = __UNCONST(""); 742 fake.pw_dir = nonexist; 743 fake.pw_shell = nonexist; 744 745 return (&fake); 746 } 747