getgrent.c (11286) | getgrent.c (11659) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 149 unchanged lines hidden (view full) --- 158 * This is a disgusting hack, used to determine when YP is enabled. 159 * This would be easier if we had a group database to go along with 160 * the password database. 161 */ 162 { 163 char *line; 164 size_t linelen; 165 _gr_yp_enabled = 0; | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 149 unchanged lines hidden (view full) --- 158 * This is a disgusting hack, used to determine when YP is enabled. 159 * This would be easier if we had a group database to go along with 160 * the password database. 161 */ 162 { 163 char *line; 164 size_t linelen; 165 _gr_yp_enabled = 0; |
166 while(line = fgetln(_gr_fp, &linelen)) { | 166 while((line = fgetln(_gr_fp, &linelen)) != NULL) { |
167 if(line[0] == '+') { 168 if(line[1] && !_gr_yp_enabled) { 169 _gr_yp_enabled = 1; 170 } else { 171 _gr_yp_enabled = -1; 172 break; 173 } 174 } --- 121 unchanged lines hidden (view full) --- 296 break; 297 } else if (cp == NULL) 298 cp = bp; 299 } 300 *m = NULL; 301 return(1); 302 } 303 /* NOTREACHED */ | 167 if(line[0] == '+') { 168 if(line[1] && !_gr_yp_enabled) { 169 _gr_yp_enabled = 1; 170 } else { 171 _gr_yp_enabled = -1; 172 break; 173 } 174 } --- 121 unchanged lines hidden (view full) --- 296 break; 297 } else if (cp == NULL) 298 cp = bp; 299 } 300 *m = NULL; 301 return(1); 302 } 303 /* NOTREACHED */ |
304 return (0); |
|
304} 305 306#ifdef YP 307 308static int 309_gr_breakout_yp(struct group *gr, char *result) 310{ 311 char *s, *cp; --- 108 unchanged lines hidden (view full) --- 420 421 if(resultlen > sizeof(resultbuf)) { 422 free(result); 423 goto tryagain; 424 } 425 426 strcpy(resultbuf, result); 427 free(result); | 305} 306 307#ifdef YP 308 309static int 310_gr_breakout_yp(struct group *gr, char *result) 311{ 312 char *s, *cp; --- 108 unchanged lines hidden (view full) --- 421 422 if(resultlen > sizeof(resultbuf)) { 423 free(result); 424 goto tryagain; 425 } 426 427 strcpy(resultbuf, result); 428 free(result); |
428 if(result = strchr(resultbuf, '\n')) *result = '\0'; | 429 if((result = strchr(resultbuf, '\n')) != NULL) 430 *result = '\0'; |
429 if (_gr_breakout_yp(gr, resultbuf)) 430 return(1); 431 else 432 goto tryagain; 433 } 434} 435 436#endif /* YP */ | 431 if (_gr_breakout_yp(gr, resultbuf)) 432 return(1); 433 else 434 goto tryagain; 435 } 436} 437 438#endif /* YP */ |