]>
git.ipfire.org Git - thirdparty/glibc.git/blob - nis/nss_compat/compat-grp.c
1 /* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
25 #include <bits/libc-lock.h>
27 #include <rpcsvc/yp.h>
28 #include <rpcsvc/ypclnt.h>
29 #include <rpcsvc/nis.h>
32 #include "nss-nisplus.h"
33 #include "nisplus-parser.h"
35 static service_user
*ni
= NULL
;
36 static bool_t use_nisplus
= FALSE
; /* default: group_compat: nis */
37 static nis_name grptable
= NULL
; /* Name of the group table */
38 static size_t grptablelen
= 0;
40 /* Get the declaration of the parser function. */
42 #define STRUCTURE group
44 #include <nss/nss_files/files-parse.c>
46 /* Structure for remembering -group members ... */
47 #define BLACKLIST_INITIAL_SIZE 512
48 #define BLACKLIST_INCREMENT 256
64 struct blacklist_t blacklist
;
66 typedef struct ent_t ent_t
;
68 static ent_t ext_ent
= {0, 0, NULL
, 0, NULL
, NULL
, {NULL
, 0, 0}};
70 /* Protect global state against multiple changers. */
71 __libc_lock_define_initialized (static, lock
)
73 /* Prototypes for local functions. */
74 static void blacklist_store_name (const char *, ent_t
*);
75 static int in_blacklist (const char *, int, ent_t
*);
77 static enum nss_status
78 _nss_first_init (void)
82 __nss_database_lookup ("group_compat", NULL
, "nis", &ni
);
83 use_nisplus
= (strcmp (ni
->name
, "nisplus") == 0);
88 static const char key
[] = "group.org_dir.";
89 const char *local_dir
= nis_local_directory ();
90 size_t len_local_dir
= strlen (local_dir
);
92 grptable
= malloc (sizeof (key
) + len_local_dir
);
94 return NSS_STATUS_TRYAGAIN
;
96 grptablelen
= ((char *) mempcpy (mempcpy (grptable
,
97 key
, sizeof (key
) - 1),
98 local_dir
, len_local_dir
+ 1)
102 return NSS_STATUS_SUCCESS
;
105 static enum nss_status
106 internal_setgrent (ent_t
*ent
)
108 enum nss_status status
= NSS_STATUS_SUCCESS
;
110 ent
->nis
= ent
->nis_first
= 0;
112 if (_nss_first_init () != NSS_STATUS_SUCCESS
)
113 return NSS_STATUS_UNAVAIL
;
115 if (ent
->oldkey
!= NULL
)
122 if (ent
->result
!= NULL
)
124 nis_freeresult (ent
->result
);
128 if (ent
->blacklist
.data
!= NULL
)
130 ent
->blacklist
.current
= 1;
131 ent
->blacklist
.data
[0] = '|';
132 ent
->blacklist
.data
[1] = '\0';
135 ent
->blacklist
.current
= 0;
137 if (ent
->stream
== NULL
)
139 ent
->stream
= fopen ("/etc/group", "r");
141 if (ent
->stream
== NULL
)
142 status
= errno
== EAGAIN
? NSS_STATUS_TRYAGAIN
: NSS_STATUS_UNAVAIL
;
145 /* We have to make sure the file is `closed on exec'. */
148 result
= flags
= fcntl (fileno (ent
->stream
), F_GETFD
, 0);
152 result
= fcntl (fileno (ent
->stream
), F_SETFD
, flags
);
156 /* Something went wrong. Close the stream and return a
158 fclose (ent
->stream
);
160 status
= NSS_STATUS_UNAVAIL
;
165 rewind (ent
->stream
);
172 _nss_compat_setgrent (void)
174 enum nss_status result
;
176 __libc_lock_lock (lock
);
178 result
= internal_setgrent (&ext_ent
);
180 __libc_lock_unlock (lock
);
186 static enum nss_status
187 internal_endgrent (ent_t
*ent
)
189 if (ent
->stream
!= NULL
)
191 fclose (ent
->stream
);
195 ent
->nis
= ent
->nis_first
= 0;
197 if (ent
->oldkey
!= NULL
)
204 if (ent
->result
!= NULL
)
206 nis_freeresult (ent
->result
);
210 if (ent
->blacklist
.data
!= NULL
)
212 ent
->blacklist
.current
= 1;
213 ent
->blacklist
.data
[0] = '|';
214 ent
->blacklist
.data
[1] = '\0';
217 ent
->blacklist
.current
= 0;
219 return NSS_STATUS_SUCCESS
;
223 _nss_compat_endgrent (void)
225 enum nss_status result
;
227 __libc_lock_lock (lock
);
229 result
= internal_endgrent (&ext_ent
);
231 __libc_lock_unlock (lock
);
236 static enum nss_status
237 getgrent_next_nis (struct group
*result
, ent_t
*ent
, char *buffer
,
238 size_t buflen
, int *errnop
)
240 struct parser_data
*data
= (void *) buffer
;
242 char *outkey
, *outval
;
243 int outkeylen
, outvallen
, parse_res
;
246 if (yp_get_default_domain (&domain
) != YPERR_SUCCESS
)
250 return NSS_STATUS_NOTFOUND
;
257 bool_t save_nis_first
;
261 if (yp_first (domain
, "group.byname", &outkey
, &outkeylen
,
262 &outval
, &outvallen
) != YPERR_SUCCESS
)
265 return NSS_STATUS_UNAVAIL
;
268 if ( buflen
< ((size_t) outvallen
+ 1))
272 return NSS_STATUS_TRYAGAIN
;
275 save_oldkey
= ent
->oldkey
;
276 save_oldlen
= ent
->oldkeylen
;
277 save_nis_first
= TRUE
;
278 ent
->oldkey
= outkey
;
279 ent
->oldkeylen
= outkeylen
;
280 ent
->nis_first
= FALSE
;
284 if (yp_next (domain
, "group.byname", ent
->oldkey
, ent
->oldkeylen
,
285 &outkey
, &outkeylen
, &outval
, &outvallen
)
290 return NSS_STATUS_NOTFOUND
;
293 if ( buflen
< ((size_t) outvallen
+ 1))
297 return NSS_STATUS_TRYAGAIN
;
300 save_oldkey
= ent
->oldkey
;
301 save_oldlen
= ent
->oldkeylen
;
302 save_nis_first
= FALSE
;
303 ent
->oldkey
= outkey
;
304 ent
->oldkeylen
= outkeylen
;
307 /* Copy the found data to our buffer... */
308 p
= strncpy (buffer
, outval
, buflen
);
310 /* ...and free the data. */
316 parse_res
= _nss_files_parse_grent (p
, result
, data
, buflen
, errnop
);
320 ent
->oldkey
= save_oldkey
;
321 ent
->oldkeylen
= save_oldlen
;
322 ent
->nis_first
= save_nis_first
;
324 return NSS_STATUS_TRYAGAIN
;
333 in_blacklist (result
->gr_name
, strlen (result
->gr_name
), ent
))
334 parse_res
= 0; /* if result->gr_name in blacklist,search next entry */
338 return NSS_STATUS_SUCCESS
;
341 static enum nss_status
342 getgrent_next_nisplus (struct group
*result
, ent_t
*ent
, char *buffer
,
343 size_t buflen
, int *errnop
)
349 nis_result
*save_oldres
;
350 bool_t save_nis_first
;
354 save_oldres
= ent
->result
;
355 save_nis_first
= TRUE
;
356 ent
->result
= nis_first_entry(grptable
);
357 if (niserr2nss (ent
->result
->status
) != NSS_STATUS_SUCCESS
)
360 return niserr2nss (ent
->result
->status
);
362 ent
->nis_first
= FALSE
;
368 save_oldres
= ent
->result
;
369 save_nis_first
= FALSE
;
370 res
= nis_next_entry(grptable
, &ent
->result
->cookie
);
372 if (niserr2nss (ent
->result
->status
) != NSS_STATUS_SUCCESS
)
375 return niserr2nss (ent
->result
->status
);
378 parse_res
= _nss_nisplus_parse_grent (ent
->result
, 0, result
,
379 buffer
, buflen
, errnop
);
382 nis_freeresult (ent
->result
);
383 ent
->result
= save_oldres
;
384 ent
->nis_first
= save_nis_first
;
386 return NSS_STATUS_TRYAGAIN
;
391 nis_freeresult (save_oldres
);
395 in_blacklist (result
->gr_name
, strlen (result
->gr_name
), ent
))
396 parse_res
= 0; /* if result->gr_name in blacklist,search next entry */
400 return NSS_STATUS_SUCCESS
;
403 /* This function handle the +group entrys in /etc/group */
404 static enum nss_status
405 getgrnam_plusgroup (const char *name
, struct group
*result
, char *buffer
,
406 size_t buflen
, int *errnop
)
408 struct parser_data
*data
= (void *) buffer
;
411 if (use_nisplus
) /* Do the NIS+ query here */
414 char buf
[strlen (name
) + 24 + grptablelen
];
416 sprintf(buf
, "[name=%s],%s", name
, grptable
);
417 res
= nis_list(buf
, FOLLOW_PATH
| FOLLOW_LINKS
, NULL
, NULL
);
418 if (niserr2nss (res
->status
) != NSS_STATUS_SUCCESS
)
420 enum nss_status status
= niserr2nss (res
->status
);
422 nis_freeresult (res
);
425 parse_res
= _nss_nisplus_parse_grent (res
, 0, result
, buffer
, buflen
,
429 nis_freeresult (res
);
431 return NSS_STATUS_TRYAGAIN
;
433 nis_freeresult (res
);
437 char *domain
, *outval
, *p
;
440 if (yp_get_default_domain (&domain
) != YPERR_SUCCESS
)
443 return NSS_STATUS_NOTFOUND
;
446 if (yp_match (domain
, "group.byname", name
, strlen (name
),
447 &outval
, &outvallen
) != YPERR_SUCCESS
)
450 return NSS_STATUS_NOTFOUND
;
453 if (buflen
< ((size_t) outvallen
+ 1))
457 return NSS_STATUS_TRYAGAIN
;
460 /* Copy the found data to our buffer... */
461 p
= strncpy (buffer
, outval
, buflen
);
463 /* ... and free the data. */
467 parse_res
= _nss_files_parse_grent (p
, result
, data
, buflen
, errnop
);
469 return NSS_STATUS_TRYAGAIN
;
473 /* We found the entry. */
474 return NSS_STATUS_SUCCESS
;
476 return NSS_STATUS_RETURN
;
479 static enum nss_status
480 getgrent_next_file (struct group
*result
, ent_t
*ent
,
481 char *buffer
, size_t buflen
, int *errnop
)
483 struct parser_data
*data
= (void *) buffer
;
492 fgetpos (ent
->stream
, &pos
);
493 buffer
[buflen
- 1] = '\xff';
494 p
= fgets (buffer
, buflen
, ent
->stream
);
495 if (p
== NULL
&& feof (ent
->stream
))
498 return NSS_STATUS_NOTFOUND
;
500 if (p
== NULL
|| buffer
[buflen
- 1] != '\xff')
502 fsetpos (ent
->stream
, &pos
);
504 return NSS_STATUS_TRYAGAIN
;
507 /* Terminate the line for any case. */
508 buffer
[buflen
- 1] = '\0';
510 /* Skip leading blanks. */
514 while (*p
== '\0' || *p
== '#' || /* Ignore empty and comment lines. */
515 /* Parse the line. If it is invalid, loop to
516 get the next line of the file to parse. */
517 !(parse_res
= _nss_files_parse_grent (p
, result
, data
, buflen
,
522 /* The parser ran out of space. */
523 fsetpos (ent
->stream
, &pos
);
525 return NSS_STATUS_TRYAGAIN
;
528 if (result
->gr_name
[0] != '+' && result
->gr_name
[0] != '-')
529 /* This is a real entry. */
533 if (result
->gr_name
[0] == '-' && result
->gr_name
[1] != '\0'
534 && result
->gr_name
[1] != '@')
536 blacklist_store_name (&result
->gr_name
[1], ent
);
541 if (result
->gr_name
[0] == '+' && result
->gr_name
[1] != '\0'
542 && result
->gr_name
[1] != '@')
544 enum nss_status status
;
546 /* Store the group in the blacklist for the "+" at the end of
548 blacklist_store_name (&result
->gr_name
[1], ent
);
549 status
= getgrnam_plusgroup (&result
->gr_name
[1], result
, buffer
,
551 if (status
== NSS_STATUS_SUCCESS
) /* We found the entry. */
554 if (status
== NSS_STATUS_RETURN
/* We couldn't parse the entry */
555 || status
== NSS_STATUS_NOTFOUND
) /* No group in NIS */
559 if (status
== NSS_STATUS_TRYAGAIN
)
561 /* The parser ran out of space. */
562 fsetpos (ent
->stream
, &pos
);
570 if (result
->gr_name
[0] == '+' && result
->gr_name
[1] == '\0')
573 ent
->nis_first
= TRUE
;
576 return getgrent_next_nisplus (result
, ent
, buffer
, buflen
, errnop
);
578 return getgrent_next_nis (result
, ent
, buffer
, buflen
, errnop
);
582 return NSS_STATUS_SUCCESS
;
586 static enum nss_status
587 internal_getgrent_r (struct group
*gr
, ent_t
*ent
, char *buffer
,
588 size_t buflen
, int *errnop
)
593 return getgrent_next_nisplus (gr
, ent
, buffer
, buflen
, errnop
);
595 return getgrent_next_nis (gr
, ent
, buffer
, buflen
, errnop
);
598 return getgrent_next_file (gr
, ent
, buffer
, buflen
, errnop
);
602 _nss_compat_getgrent_r (struct group
*grp
, char *buffer
, size_t buflen
,
605 enum nss_status status
= NSS_STATUS_SUCCESS
;
607 __libc_lock_lock (lock
);
609 /* Be prepared that the setgrent function was not called before. */
610 if (ext_ent
.stream
== NULL
)
611 status
= internal_setgrent (&ext_ent
);
613 if (status
== NSS_STATUS_SUCCESS
)
614 status
= internal_getgrent_r (grp
, &ext_ent
, buffer
, buflen
, errnop
);
616 __libc_lock_unlock (lock
);
621 /* Searches in /etc/group and the NIS/NIS+ map for a special group */
622 static enum nss_status
623 internal_getgrnam_r (const char *name
, struct group
*result
, ent_t
*ent
,
624 char *buffer
, size_t buflen
, int *errnop
)
626 struct parser_data
*data
= (void *) buffer
;
635 fgetpos (ent
->stream
, &pos
);
636 buffer
[buflen
- 1] = '\xff';
637 p
= fgets (buffer
, buflen
, ent
->stream
);
638 if (p
== NULL
&& feof (ent
->stream
))
641 return NSS_STATUS_NOTFOUND
;
643 if (p
== NULL
|| buffer
[buflen
- 1] != '\xff')
645 fsetpos (ent
->stream
, &pos
);
647 return NSS_STATUS_TRYAGAIN
;
650 /* Terminate the line for any case. */
651 buffer
[buflen
- 1] = '\0';
653 /* Skip leading blanks. */
657 while (*p
== '\0' || *p
== '#' || /* Ignore empty and comment lines. */
658 /* Parse the line. If it is invalid, loop to
659 get the next line of the file to parse. */
660 !(parse_res
= _nss_files_parse_grent (p
, result
, data
, buflen
,
665 /* The parser ran out of space. */
666 fsetpos (ent
->stream
, &pos
);
668 return NSS_STATUS_TRYAGAIN
;
671 /* This is a real entry. */
672 if (result
->gr_name
[0] != '+' && result
->gr_name
[0] != '-')
674 if (strcmp (result
->gr_name
, name
) == 0)
675 return NSS_STATUS_SUCCESS
;
681 if (result
->gr_name
[0] == '-' && result
->gr_name
[1] != '\0')
683 if (strcmp (&result
->gr_name
[1], name
) == 0)
686 return NSS_STATUS_NOTFOUND
;
693 if (result
->gr_name
[0] == '+' && result
->gr_name
[1] != '\0')
695 if (strcmp (name
, &result
->gr_name
[1]) == 0)
697 enum nss_status status
;
699 status
= getgrnam_plusgroup (name
, result
, buffer
, buflen
,
701 if (status
== NSS_STATUS_RETURN
)
702 /* We couldn't parse the entry */
709 if (result
->gr_name
[0] == '+' && result
->gr_name
[1] == '\0')
711 enum nss_status status
;
713 status
= getgrnam_plusgroup (name
, result
, buffer
, buflen
, errnop
);
714 if (status
== NSS_STATUS_RETURN
)
715 /* We couldn't parse the entry */
722 return NSS_STATUS_SUCCESS
;
726 _nss_compat_getgrnam_r (const char *name
, struct group
*grp
,
727 char *buffer
, size_t buflen
, int *errnop
)
729 ent_t ent
= {0, 0, NULL
, 0, NULL
, NULL
, {NULL
, 0, 0}};
730 enum nss_status status
;
732 if (name
[0] == '-' || name
[0] == '+')
735 return NSS_STATUS_NOTFOUND
;
738 __libc_lock_lock (lock
);
740 status
= internal_setgrent (&ent
);
742 __libc_lock_unlock (lock
);
744 if (status
!= NSS_STATUS_SUCCESS
)
747 status
= internal_getgrnam_r (name
, grp
, &ent
, buffer
, buflen
, errnop
);
749 internal_endgrent (&ent
);
754 /* This function handle the + entry in /etc/group */
755 static enum nss_status
756 getgrgid_plusgroup (gid_t gid
, struct group
*result
, char *buffer
,
757 size_t buflen
, int *errnop
)
759 struct parser_data
*data
= (void *) buffer
;
762 if (use_nisplus
) /* Do the NIS+ query here */
765 char buf
[24 + grptablelen
];
767 sprintf(buf
, "[gid=%d],%s", gid
, grptable
);
768 res
= nis_list(buf
, FOLLOW_PATH
| FOLLOW_LINKS
, NULL
, NULL
);
769 if (niserr2nss (res
->status
) != NSS_STATUS_SUCCESS
)
771 enum nss_status status
= niserr2nss (res
->status
);
773 nis_freeresult (res
);
776 if ((parse_res
= _nss_nisplus_parse_grent (res
, 0, result
, buffer
,
777 buflen
, errnop
)) == -1)
779 nis_freeresult (res
);
781 return NSS_STATUS_TRYAGAIN
;
783 nis_freeresult (res
);
788 char *domain
, *outval
, *p
;
791 if (yp_get_default_domain (&domain
) != YPERR_SUCCESS
)
794 return NSS_STATUS_NOTFOUND
;
797 snprintf (buf
, sizeof (buf
), "%d", gid
);
799 if (yp_match (domain
, "group.bygid", buf
, strlen (buf
),
800 &outval
, &outvallen
) != YPERR_SUCCESS
)
803 return NSS_STATUS_NOTFOUND
;
806 if (buflen
< ((size_t) outvallen
+ 1))
810 return NSS_STATUS_TRYAGAIN
;
813 /* Copy the found data to our buffer... */
814 p
= strncpy (buffer
, outval
, buflen
);
816 /* ... and free the data. */
821 parse_res
= _nss_files_parse_grent (p
, result
, data
, buflen
, errnop
);
823 return NSS_STATUS_TRYAGAIN
;
827 /* We found the entry. */
828 return NSS_STATUS_SUCCESS
;
830 return NSS_STATUS_RETURN
;
833 /* Searches in /etc/group and the NIS/NIS+ map for a special group id */
834 static enum nss_status
835 internal_getgrgid_r (gid_t gid
, struct group
*result
, ent_t
*ent
,
836 char *buffer
, size_t buflen
, int *errnop
)
838 struct parser_data
*data
= (void *) buffer
;
847 fgetpos (ent
->stream
, &pos
);
848 buffer
[buflen
- 1] = '\xff';
849 p
= fgets (buffer
, buflen
, ent
->stream
);
850 if (p
== NULL
&& feof (ent
->stream
))
853 return NSS_STATUS_NOTFOUND
;
855 if (p
== NULL
|| buffer
[buflen
- 1] != '\xff')
857 fsetpos (ent
->stream
, &pos
);
859 return NSS_STATUS_TRYAGAIN
;
862 /* Terminate the line for any case. */
863 buffer
[buflen
- 1] = '\0';
865 /* Skip leading blanks. */
869 while (*p
== '\0' || *p
== '#' || /* Ignore empty and comment lines. */
870 /* Parse the line. If it is invalid, loop to
871 get the next line of the file to parse. */
872 !(parse_res
= _nss_files_parse_grent (p
, result
, data
, buflen
,
877 /* The parser ran out of space. */
878 fsetpos (ent
->stream
, &pos
);
880 return NSS_STATUS_TRYAGAIN
;
883 /* This is a real entry. */
884 if (result
->gr_name
[0] != '+' && result
->gr_name
[0] != '-')
886 if (result
->gr_gid
== gid
)
887 return NSS_STATUS_SUCCESS
;
893 if (result
->gr_name
[0] == '-' && result
->gr_name
[1] != '\0')
895 blacklist_store_name (&result
->gr_name
[1], ent
);
900 if (result
->gr_name
[0] == '+' && result
->gr_name
[1] != '\0')
902 enum nss_status status
;
904 /* Store the group in the blacklist for the "+" at the end of
906 blacklist_store_name (&result
->gr_name
[1], ent
);
907 status
= getgrnam_plusgroup (&result
->gr_name
[1], result
, buffer
,
909 if (status
== NSS_STATUS_SUCCESS
&& result
->gr_gid
== gid
)
915 if (result
->gr_name
[0] == '+' && result
->gr_name
[1] == '\0')
917 enum nss_status status
;
919 status
= getgrgid_plusgroup (gid
, result
, buffer
, buflen
, errnop
);
920 if (status
== NSS_STATUS_RETURN
) /* We couldn't parse the entry */
923 return NSS_STATUS_NOTFOUND
;
930 return NSS_STATUS_SUCCESS
;
934 _nss_compat_getgrgid_r (gid_t gid
, struct group
*grp
,
935 char *buffer
, size_t buflen
, int *errnop
)
937 ent_t ent
= {0, 0, NULL
, 0, NULL
, NULL
, {NULL
, 0, 0}};
938 enum nss_status status
;
940 __libc_lock_lock (lock
);
942 status
= internal_setgrent (&ent
);
944 __libc_lock_unlock (lock
);
946 if (status
!= NSS_STATUS_SUCCESS
)
949 status
= internal_getgrgid_r (gid
, grp
, &ent
, buffer
, buflen
, errnop
);
951 internal_endgrent (&ent
);
957 /* Support routines for remembering -@netgroup and -user entries.
958 The names are stored in a single string with `|' as separator. */
960 blacklist_store_name (const char *name
, ent_t
*ent
)
962 int namelen
= strlen (name
);
965 /* first call, setup cache */
966 if (ent
->blacklist
.size
== 0)
968 ent
->blacklist
.size
= MAX (BLACKLIST_INITIAL_SIZE
, 2 * namelen
);
969 ent
->blacklist
.data
= malloc (ent
->blacklist
.size
);
970 if (ent
->blacklist
.data
== NULL
)
972 ent
->blacklist
.data
[0] = '|';
973 ent
->blacklist
.data
[1] = '\0';
974 ent
->blacklist
.current
= 1;
978 if (in_blacklist (name
, namelen
, ent
))
979 return; /* no duplicates */
981 if (ent
->blacklist
.current
+ namelen
+ 1 >= ent
->blacklist
.size
)
983 ent
->blacklist
.size
+= MAX (BLACKLIST_INCREMENT
, 2 * namelen
);
984 tmp
= realloc (ent
->blacklist
.data
, ent
->blacklist
.size
);
987 free (ent
->blacklist
.data
);
988 ent
->blacklist
.size
= 0;
991 ent
->blacklist
.data
= tmp
;
995 tmp
= stpcpy (ent
->blacklist
.data
+ ent
->blacklist
.current
, name
);
998 ent
->blacklist
.current
+= namelen
+ 1;
1003 /* returns TRUE if ent->blacklist contains name, else FALSE */
1005 in_blacklist (const char *name
, int namelen
, ent_t
*ent
)
1007 char buf
[namelen
+ 3];
1010 if (ent
->blacklist
.data
== NULL
)
1014 cp
= stpcpy (&buf
[1], name
);
1017 return strstr (ent
->blacklist
.data
, buf
) != NULL
;