Changeset 30 for trunk/samba/source/lib/replace/replace.c
- Timestamp:
- Apr 25, 2007, 9:44:55 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/samba/source/lib/replace/replace.c
r1 r30 153 153 } 154 154 #endif /* !HAVE_MKTIME */ 155 156 157 #ifndef HAVE_INNETGR158 #if defined(HAVE_SETNETGRENT) && defined(HAVE_GETNETGRENT) && defined(HAVE_ENDNETGRENT)159 /*160 * Search for a match in a netgroup. This replaces it on broken systems.161 */162 int rep_innetgr(const char *group, const char *host, const char *user,163 const char *dom)164 {165 char *hst, *usr, *dm;166 167 setnetgrent(group);168 while (getnetgrent(&hst, &usr, &dm)) {169 if (((host == 0) || (hst == 0) || !strcmp(host, hst)) &&170 ((user == 0) || (usr == 0) || !strcmp(user, usr)) &&171 ((dom == 0) || (dm == 0) || !strcmp(dom, dm))) {172 endnetgrent();173 return (1);174 }175 }176 endnetgrent();177 return (0);178 }179 #endif /* HAVE_SETNETGRENT HAVE_GETNETGRENT HAVE_ENDNETGRENT */180 #endif /* HAVE_INNETGR */181 182 155 183 156 … … 591 564 #endif 592 565 566 #ifndef HAVE_UNSETENV 567 int rep_unsetenv(const char *name) 568 { 569 extern char **environ; 570 size_t len = strlen(name); 571 size_t i; 572 int found = 0; 573 574 for (i=0; (environ && environ[i]); i++) { 575 if (found) { 576 environ[i-1] = environ[i]; 577 continue; 578 } 579 580 if (strncmp(environ[i], name, len) == 0 && environ[i][len] == '=') { 581 free(environ[i]); 582 environ[i] = NULL; 583 found = 1; 584 continue; 585 } 586 } 587 588 return 0; 589 } 590 #endif 591 593 592 #ifndef HAVE_SOCKETPAIR 594 593 int rep_socketpair(int d, int type, int protocol, int sv[2])
Note: See TracChangeset
for help on using the changeset viewer.