Changeset a0a225f in rtems
- Timestamp:
- 07/02/99 18:50:40 (25 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- c8d9183
- Parents:
- c51917f3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/libcsupport/src/getgrent.c
rc51917f3 ra0a225f 1 1 /* 2 * POSIX 1003.1b - 9.2.1 - Group Database Access Routines 3 * 4 * The license and distribution terms for this file may be 5 * found in the file LICENSE in this distribution or at 6 * http://www.OARcorp.com/rtems/license.html. 7 * 2 8 * $Id$ 3 9 */ 10 4 11 5 12 #include <stdio.h> … … 15 22 static FILE *group_fp; 16 23 24 /* 25 * The size of these buffers is arbitrary and there is no provision 26 * to protect any of them from overflowing. The scanf patterns 27 * need to be changed to prevent overflowing. In addition, 28 * the limits on these needs to be examined. 29 */ 30 17 31 static char groupname[8]; 18 32 static char password[1024]; 19 33 static char groups[1024]; 20 34 static char *gr_mem[16] = { } ; 35 36 extern void init_etc_passwd_group(void); 21 37 22 38 int getgrnam_r( … … 29 45 { 30 46 FILE *fp; 47 48 init_etc_passwd_group(); 31 49 32 50 if ((fp = fopen ("/etc/group", "r")) == NULL) { … … 76 94 { 77 95 FILE *fp; 96 97 init_etc_passwd_group(); 78 98 79 99 if ((fp = fopen ("/etc/group", "r")) == NULL) { … … 138 158 setgrent () 139 159 { 160 init_etc_passwd_group(); 161 140 162 if (group_fp != NULL) 141 163 fclose (group_fp); -
c/src/exec/libcsupport/src/getpwent.c
rc51917f3 ra0a225f 1 /* 2 * POSIX 1003.1b - 9.2.2 - User Database Access Routines 3 * 4 * The license and distribution terms for this file may be 5 * found in the file LICENSE in this distribution or at 6 * http://www.OARcorp.com/rtems/license.html. 7 * 8 * $Id$ 9 */ 10 1 11 #include <stdio.h> 2 12 #include <sys/types.h> … … 7 17 #include <string.h> 8 18 #include <limits.h> 19 #include <fcntl.h> 20 #include <unistd.h> 9 21 10 22 static struct passwd pw_passwd; /* password structure */ 11 23 static FILE *passwd_fp; 24 25 /* 26 * The size of these buffers is arbitrary and there is no provision 27 * to protect any of them from overflowing. The scanf patterns 28 * need to be changed to prevent overflowing. In addition, 29 * the limits on these needs to be examined. 30 */ 12 31 13 32 static char logname[8]; … … 18 37 static char shell[1024]; 19 38 39 /* 40 * Initialize a useable but dummy /etc/passwd 41 * 42 * NOTE: Ignore all errors. 43 * 44 */ 45 46 static char etc_passwd_initted = 0; 47 48 void init_etc_passwd_group(void) 49 { 50 FILE *fp; 51 52 if ( etc_passwd_initted ) 53 return; 54 etc_passwd_initted = 1; 55 56 (void) mkdir( "/etc", S_IRWXU | S_IRWXG | S_IRWXO ); 57 58 /* 59 * Initialize /etc/passwd 60 */ 61 62 if ((fp = fopen ("/etc/passwd", "w")) == NULL) 63 return; 64 65 fprintf( fp, "root:*:0:0:root,,,,:/tmp:/bin/false\n" 66 "rtems:*:1:1:RTEMS Application,,,,:/tmp:/bin/false\n" ); 67 68 fclose( fp ); 69 70 /* 71 * Initialize /etc/group 72 */ 73 74 if ((fp = fopen ("/etc/group", "w")) == NULL) 75 return; 76 77 fprintf( fp, "root::0:root\n" 78 "rtems::0:rtems\n" ); 79 80 fclose( fp ); 81 } 82 20 83 int getpwnam_r( 21 84 const char *name, … … 27 90 { 28 91 FILE *fp; 92 93 init_etc_passwd_group(); 29 94 30 95 if ((fp = fopen ("/etc/passwd", "r")) == NULL) { … … 79 144 FILE *fp; 80 145 146 init_etc_passwd_group(); 147 81 148 if ((fp = fopen ("/etc/passwd", "r")) == NULL) { 82 149 errno = EINVAL; … … 146 213 void setpwent( void ) 147 214 { 215 init_etc_passwd_group(); 216 148 217 if (passwd_fp != NULL) 149 218 fclose (passwd_fp); -
c/src/lib/libc/getgrent.c
rc51917f3 ra0a225f 1 1 /* 2 * POSIX 1003.1b - 9.2.1 - Group Database Access Routines 3 * 4 * The license and distribution terms for this file may be 5 * found in the file LICENSE in this distribution or at 6 * http://www.OARcorp.com/rtems/license.html. 7 * 2 8 * $Id$ 3 9 */ 10 4 11 5 12 #include <stdio.h> … … 15 22 static FILE *group_fp; 16 23 24 /* 25 * The size of these buffers is arbitrary and there is no provision 26 * to protect any of them from overflowing. The scanf patterns 27 * need to be changed to prevent overflowing. In addition, 28 * the limits on these needs to be examined. 29 */ 30 17 31 static char groupname[8]; 18 32 static char password[1024]; 19 33 static char groups[1024]; 20 34 static char *gr_mem[16] = { } ; 35 36 extern void init_etc_passwd_group(void); 21 37 22 38 int getgrnam_r( … … 29 45 { 30 46 FILE *fp; 47 48 init_etc_passwd_group(); 31 49 32 50 if ((fp = fopen ("/etc/group", "r")) == NULL) { … … 76 94 { 77 95 FILE *fp; 96 97 init_etc_passwd_group(); 78 98 79 99 if ((fp = fopen ("/etc/group", "r")) == NULL) { … … 138 158 setgrent () 139 159 { 160 init_etc_passwd_group(); 161 140 162 if (group_fp != NULL) 141 163 fclose (group_fp); -
c/src/lib/libc/getpwent.c
rc51917f3 ra0a225f 1 /* 2 * POSIX 1003.1b - 9.2.2 - User Database Access Routines 3 * 4 * The license and distribution terms for this file may be 5 * found in the file LICENSE in this distribution or at 6 * http://www.OARcorp.com/rtems/license.html. 7 * 8 * $Id$ 9 */ 10 1 11 #include <stdio.h> 2 12 #include <sys/types.h> … … 7 17 #include <string.h> 8 18 #include <limits.h> 19 #include <fcntl.h> 20 #include <unistd.h> 9 21 10 22 static struct passwd pw_passwd; /* password structure */ 11 23 static FILE *passwd_fp; 24 25 /* 26 * The size of these buffers is arbitrary and there is no provision 27 * to protect any of them from overflowing. The scanf patterns 28 * need to be changed to prevent overflowing. In addition, 29 * the limits on these needs to be examined. 30 */ 12 31 13 32 static char logname[8]; … … 18 37 static char shell[1024]; 19 38 39 /* 40 * Initialize a useable but dummy /etc/passwd 41 * 42 * NOTE: Ignore all errors. 43 * 44 */ 45 46 static char etc_passwd_initted = 0; 47 48 void init_etc_passwd_group(void) 49 { 50 FILE *fp; 51 52 if ( etc_passwd_initted ) 53 return; 54 etc_passwd_initted = 1; 55 56 (void) mkdir( "/etc", S_IRWXU | S_IRWXG | S_IRWXO ); 57 58 /* 59 * Initialize /etc/passwd 60 */ 61 62 if ((fp = fopen ("/etc/passwd", "w")) == NULL) 63 return; 64 65 fprintf( fp, "root:*:0:0:root,,,,:/tmp:/bin/false\n" 66 "rtems:*:1:1:RTEMS Application,,,,:/tmp:/bin/false\n" ); 67 68 fclose( fp ); 69 70 /* 71 * Initialize /etc/group 72 */ 73 74 if ((fp = fopen ("/etc/group", "w")) == NULL) 75 return; 76 77 fprintf( fp, "root::0:root\n" 78 "rtems::0:rtems\n" ); 79 80 fclose( fp ); 81 } 82 20 83 int getpwnam_r( 21 84 const char *name, … … 27 90 { 28 91 FILE *fp; 92 93 init_etc_passwd_group(); 29 94 30 95 if ((fp = fopen ("/etc/passwd", "r")) == NULL) { … … 79 144 FILE *fp; 80 145 146 init_etc_passwd_group(); 147 81 148 if ((fp = fopen ("/etc/passwd", "r")) == NULL) { 82 149 errno = EINVAL; … … 146 213 void setpwent( void ) 147 214 { 215 init_etc_passwd_group(); 216 148 217 if (passwd_fp != NULL) 149 218 fclose (passwd_fp); -
cpukit/libcsupport/src/getgrent.c
rc51917f3 ra0a225f 1 1 /* 2 * POSIX 1003.1b - 9.2.1 - Group Database Access Routines 3 * 4 * The license and distribution terms for this file may be 5 * found in the file LICENSE in this distribution or at 6 * http://www.OARcorp.com/rtems/license.html. 7 * 2 8 * $Id$ 3 9 */ 10 4 11 5 12 #include <stdio.h> … … 15 22 static FILE *group_fp; 16 23 24 /* 25 * The size of these buffers is arbitrary and there is no provision 26 * to protect any of them from overflowing. The scanf patterns 27 * need to be changed to prevent overflowing. In addition, 28 * the limits on these needs to be examined. 29 */ 30 17 31 static char groupname[8]; 18 32 static char password[1024]; 19 33 static char groups[1024]; 20 34 static char *gr_mem[16] = { } ; 35 36 extern void init_etc_passwd_group(void); 21 37 22 38 int getgrnam_r( … … 29 45 { 30 46 FILE *fp; 47 48 init_etc_passwd_group(); 31 49 32 50 if ((fp = fopen ("/etc/group", "r")) == NULL) { … … 76 94 { 77 95 FILE *fp; 96 97 init_etc_passwd_group(); 78 98 79 99 if ((fp = fopen ("/etc/group", "r")) == NULL) { … … 138 158 setgrent () 139 159 { 160 init_etc_passwd_group(); 161 140 162 if (group_fp != NULL) 141 163 fclose (group_fp); -
cpukit/libcsupport/src/getpwent.c
rc51917f3 ra0a225f 1 /* 2 * POSIX 1003.1b - 9.2.2 - User Database Access Routines 3 * 4 * The license and distribution terms for this file may be 5 * found in the file LICENSE in this distribution or at 6 * http://www.OARcorp.com/rtems/license.html. 7 * 8 * $Id$ 9 */ 10 1 11 #include <stdio.h> 2 12 #include <sys/types.h> … … 7 17 #include <string.h> 8 18 #include <limits.h> 19 #include <fcntl.h> 20 #include <unistd.h> 9 21 10 22 static struct passwd pw_passwd; /* password structure */ 11 23 static FILE *passwd_fp; 24 25 /* 26 * The size of these buffers is arbitrary and there is no provision 27 * to protect any of them from overflowing. The scanf patterns 28 * need to be changed to prevent overflowing. In addition, 29 * the limits on these needs to be examined. 30 */ 12 31 13 32 static char logname[8]; … … 18 37 static char shell[1024]; 19 38 39 /* 40 * Initialize a useable but dummy /etc/passwd 41 * 42 * NOTE: Ignore all errors. 43 * 44 */ 45 46 static char etc_passwd_initted = 0; 47 48 void init_etc_passwd_group(void) 49 { 50 FILE *fp; 51 52 if ( etc_passwd_initted ) 53 return; 54 etc_passwd_initted = 1; 55 56 (void) mkdir( "/etc", S_IRWXU | S_IRWXG | S_IRWXO ); 57 58 /* 59 * Initialize /etc/passwd 60 */ 61 62 if ((fp = fopen ("/etc/passwd", "w")) == NULL) 63 return; 64 65 fprintf( fp, "root:*:0:0:root,,,,:/tmp:/bin/false\n" 66 "rtems:*:1:1:RTEMS Application,,,,:/tmp:/bin/false\n" ); 67 68 fclose( fp ); 69 70 /* 71 * Initialize /etc/group 72 */ 73 74 if ((fp = fopen ("/etc/group", "w")) == NULL) 75 return; 76 77 fprintf( fp, "root::0:root\n" 78 "rtems::0:rtems\n" ); 79 80 fclose( fp ); 81 } 82 20 83 int getpwnam_r( 21 84 const char *name, … … 27 90 { 28 91 FILE *fp; 92 93 init_etc_passwd_group(); 29 94 30 95 if ((fp = fopen ("/etc/passwd", "r")) == NULL) { … … 79 144 FILE *fp; 80 145 146 init_etc_passwd_group(); 147 81 148 if ((fp = fopen ("/etc/passwd", "r")) == NULL) { 82 149 errno = EINVAL; … … 146 213 void setpwent( void ) 147 214 { 215 init_etc_passwd_group(); 216 148 217 if (passwd_fp != NULL) 149 218 fclose (passwd_fp);
Note: See TracChangeset
for help on using the changeset viewer.