login.c (ba174a5e38b1ab764c4a36ef4dd83e80c4add148) | login.c (2966d28c322dcfa4b9db2558da0b91839e7798b9) |
---|---|
1/*- 2 * Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 2002 Networks Associates Technologies, Inc. 5 * All rights reserved. 6 * 7 * Portions of this software were developed for the FreeBSD Project by 8 * ThinkSec AS and NAI Labs, the Security Research Division of Network --- 752 unchanged lines hidden (view full) --- 761 */ 762static int 763export(const char *s) 764{ 765 static const char *noexport[] = { 766 "SHELL", "HOME", "LOGNAME", "MAIL", "CDPATH", 767 "IFS", "PATH", NULL 768 }; | 1/*- 2 * Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 2002 Networks Associates Technologies, Inc. 5 * All rights reserved. 6 * 7 * Portions of this software were developed for the FreeBSD Project by 8 * ThinkSec AS and NAI Labs, the Security Research Division of Network --- 752 unchanged lines hidden (view full) --- 761 */ 762static int 763export(const char *s) 764{ 765 static const char *noexport[] = { 766 "SHELL", "HOME", "LOGNAME", "MAIL", "CDPATH", 767 "IFS", "PATH", NULL 768 }; |
769 char *p; |
|
769 const char **pp; 770 size_t n; 771 | 770 const char **pp; 771 size_t n; 772 |
772 if (strlen(s) > 1024 || strchr(s, '=') == NULL) | 773 if (strlen(s) > 1024 || (p = strchr(s, '=')) == NULL) |
773 return (0); 774 if (strncmp(s, "LD_", 3) == 0) 775 return (0); 776 for (pp = noexport; *pp != NULL; pp++) { 777 n = strlen(*pp); 778 if (s[n] == '=' && strncmp(s, *pp, n) == 0) 779 return (0); 780 } | 774 return (0); 775 if (strncmp(s, "LD_", 3) == 0) 776 return (0); 777 for (pp = noexport; *pp != NULL; pp++) { 778 n = strlen(*pp); 779 if (s[n] == '=' && strncmp(s, *pp, n) == 0) 780 return (0); 781 } |
781 (void)putenv(s); | 782 *p = '\0'; 783 (void)setenv(s, p + 1, 1); 784 *p = '='; |
782 return (1); 783} 784 785static void 786usage() 787{ 788 789 (void)fprintf(stderr, "usage: login [-fp] [-h hostname] [username]\n"); --- 187 unchanged lines hidden --- | 785 return (1); 786} 787 788static void 789usage() 790{ 791 792 (void)fprintf(stderr, "usage: login [-fp] [-h hostname] [username]\n"); --- 187 unchanged lines hidden --- |