17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*ff22156cSsemery * Common Development and Distribution License (the "License").
6*ff22156cSsemery * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
217c478bd9Sstevel@tonic-gate /*
22*ff22156cSsemery * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
237c478bd9Sstevel@tonic-gate * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate */
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate #include <stdio.h>
277c478bd9Sstevel@tonic-gate #include <stdlib.h>
287c478bd9Sstevel@tonic-gate #include <string.h>
297c478bd9Sstevel@tonic-gate #include <unistd.h>
307c478bd9Sstevel@tonic-gate #include <ctype.h>
317c478bd9Sstevel@tonic-gate #include "gsscred.h"
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate * gsscred utility
357c478bd9Sstevel@tonic-gate * Manages mapping between a security principal name and unix uid.
367c478bd9Sstevel@tonic-gate * Implementation file for the file based gsscred utility.
377c478bd9Sstevel@tonic-gate */
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gate #define MAX_ENTRY_LEN 1024
40*ff22156cSsemery
417c478bd9Sstevel@tonic-gate static const char credFile[] = "/etc/gss/gsscred_db";
427c478bd9Sstevel@tonic-gate static const char credFileTmp[] = "/etc/gss/gsscred_db.tmp";
43ce79f9d5Sdh145677 static const int expNameTokIdLen = 2;
44ce79f9d5Sdh145677 static const int mechOidLenLen = 2;
45*ff22156cSsemery static const int krb5OidTagLen = 1;
46*ff22156cSsemery static const int krb5OidLenLen = 1;
47*ff22156cSsemery static const int nameLen = 4;
48*ff22156cSsemery static const int krb5OidLen = 9;
49*ff22156cSsemery
50*ff22156cSsemery /*
51*ff22156cSsemery * Multiply by two given that the token has already gone through hex string
52*ff22156cSsemery * expansion.
53*ff22156cSsemery */
54*ff22156cSsemery #define NAME_OFFSET (expNameTokIdLen + mechOidLenLen + krb5OidTagLen + \
55*ff22156cSsemery krb5OidLenLen + krb5OidLen + nameLen) * 2
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gate static int matchEntry(const char *entry, const gss_buffer_t name,
587c478bd9Sstevel@tonic-gate const char *uid, uid_t *uidOut);
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gate /*
617c478bd9Sstevel@tonic-gate * file_addGssCredEntry
627c478bd9Sstevel@tonic-gate *
637c478bd9Sstevel@tonic-gate * Adds a new entry to the gsscred table.
647c478bd9Sstevel@tonic-gate * Does not check for duplicate entries.
657c478bd9Sstevel@tonic-gate */
file_addGssCredEntry(const gss_buffer_t hexName,const char * uid,const char * comment,char ** errDetails)667c478bd9Sstevel@tonic-gate int file_addGssCredEntry(const gss_buffer_t hexName, const char *uid,
677c478bd9Sstevel@tonic-gate const char *comment, char **errDetails)
687c478bd9Sstevel@tonic-gate {
697c478bd9Sstevel@tonic-gate FILE *fp;
707c478bd9Sstevel@tonic-gate char tmpBuf[256];
717c478bd9Sstevel@tonic-gate
727c478bd9Sstevel@tonic-gate if ((fp = fopen(credFile, "a")) == NULL) {
737c478bd9Sstevel@tonic-gate if (errDetails) {
747c478bd9Sstevel@tonic-gate (void) snprintf(tmpBuf, sizeof (tmpBuf),
757c478bd9Sstevel@tonic-gate gettext("Unable to open gsscred file [%s]"),
767c478bd9Sstevel@tonic-gate credFile);
777c478bd9Sstevel@tonic-gate *errDetails = strdup(tmpBuf);
787c478bd9Sstevel@tonic-gate }
797c478bd9Sstevel@tonic-gate return (0);
807c478bd9Sstevel@tonic-gate }
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gate (void) fprintf(fp,
837c478bd9Sstevel@tonic-gate "%s\t%s\t%s\n", (char *)hexName->value, uid, comment);
847c478bd9Sstevel@tonic-gate (void) fclose(fp);
857c478bd9Sstevel@tonic-gate return (1);
867c478bd9Sstevel@tonic-gate } /* ******* file_addGssCredEntry ****** */
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gate /*
917c478bd9Sstevel@tonic-gate * file_getGssCredEntry
927c478bd9Sstevel@tonic-gate *
937c478bd9Sstevel@tonic-gate * Searches the file for the file matching the name. Since the name
947c478bd9Sstevel@tonic-gate * contains a mechanism identifier, to search for all names for a given
957c478bd9Sstevel@tonic-gate * mechanism just supply the mechanism portion in the name buffer.
967c478bd9Sstevel@tonic-gate * To search by uid only, supply a non-null value of uid.
977c478bd9Sstevel@tonic-gate */
file_getGssCredEntry(const gss_buffer_t name,const char * uid,char ** errDetails)987c478bd9Sstevel@tonic-gate int file_getGssCredEntry(const gss_buffer_t name, const char *uid,
997c478bd9Sstevel@tonic-gate char **errDetails)
1007c478bd9Sstevel@tonic-gate {
1017c478bd9Sstevel@tonic-gate FILE *fp;
1027c478bd9Sstevel@tonic-gate char entry[MAX_ENTRY_LEN+1];
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gate if ((fp = fopen(credFile, "r")) == NULL) {
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gate if (errDetails) {
1077c478bd9Sstevel@tonic-gate (void) snprintf(entry, sizeof (entry),
1087c478bd9Sstevel@tonic-gate gettext("Unable to open gsscred file [%s]"),
1097c478bd9Sstevel@tonic-gate credFile);
1107c478bd9Sstevel@tonic-gate *errDetails = strdup(entry);
1117c478bd9Sstevel@tonic-gate }
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gate return (0);
1147c478bd9Sstevel@tonic-gate }
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gate /* go through the file in sequential order */
1177c478bd9Sstevel@tonic-gate while (fgets(entry, MAX_ENTRY_LEN, fp) != NULL) {
1187c478bd9Sstevel@tonic-gate /* is there any search criteria */
1197c478bd9Sstevel@tonic-gate if (name == NULL && uid == NULL) {
1207c478bd9Sstevel@tonic-gate (void) fprintf(stdout, "%s", entry);
1217c478bd9Sstevel@tonic-gate continue;
1227c478bd9Sstevel@tonic-gate }
1237c478bd9Sstevel@tonic-gate
1247c478bd9Sstevel@tonic-gate if (matchEntry(entry, name, uid, NULL))
1257c478bd9Sstevel@tonic-gate (void) fprintf(stdout, "%s", entry);
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate } /* while */
1287c478bd9Sstevel@tonic-gate
1297c478bd9Sstevel@tonic-gate (void) fclose(fp);
1307c478bd9Sstevel@tonic-gate return (1);
1317c478bd9Sstevel@tonic-gate } /* file_getGssCredEntry */
1327c478bd9Sstevel@tonic-gate
1337c478bd9Sstevel@tonic-gate /*
1347c478bd9Sstevel@tonic-gate * file_getGssCredUid
1357c478bd9Sstevel@tonic-gate *
1367c478bd9Sstevel@tonic-gate * GSS entry point for retrieving user uid information.
1377c478bd9Sstevel@tonic-gate * We need to go through the entire file to ensure that
1387c478bd9Sstevel@tonic-gate * the last matching entry is retrieved - this is because
1397c478bd9Sstevel@tonic-gate * new entries are added to the end, and in case of
1407c478bd9Sstevel@tonic-gate * duplicates we want to get the latest entry.
1417c478bd9Sstevel@tonic-gate */
1427c478bd9Sstevel@tonic-gate int
file_getGssCredUid(const gss_buffer_t expName,uid_t * uidOut)1437c478bd9Sstevel@tonic-gate file_getGssCredUid(const gss_buffer_t expName, uid_t *uidOut)
1447c478bd9Sstevel@tonic-gate {
1457c478bd9Sstevel@tonic-gate FILE *fp;
1467c478bd9Sstevel@tonic-gate char entry[MAX_ENTRY_LEN+1];
1477c478bd9Sstevel@tonic-gate int retVal = 0;
1487c478bd9Sstevel@tonic-gate
1497c478bd9Sstevel@tonic-gate if ((fp = fopen(credFile, "r")) == NULL)
1507c478bd9Sstevel@tonic-gate return (0);
1517c478bd9Sstevel@tonic-gate
1527c478bd9Sstevel@tonic-gate /* go through the entire file in sequential order */
1537c478bd9Sstevel@tonic-gate while (fgets(entry, MAX_ENTRY_LEN, fp) != NULL) {
1547c478bd9Sstevel@tonic-gate if (matchEntry(entry, expName, NULL, uidOut)) {
1557c478bd9Sstevel@tonic-gate retVal = 1;
1567c478bd9Sstevel@tonic-gate }
1577c478bd9Sstevel@tonic-gate } /* while */
1587c478bd9Sstevel@tonic-gate
1597c478bd9Sstevel@tonic-gate (void) fclose(fp);
1607c478bd9Sstevel@tonic-gate return (retVal);
1617c478bd9Sstevel@tonic-gate } /* file_getGssCredUid */
1627c478bd9Sstevel@tonic-gate
1637c478bd9Sstevel@tonic-gate
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gate /*
1667c478bd9Sstevel@tonic-gate *
1677c478bd9Sstevel@tonic-gate * file_deleteGssCredEntry
1687c478bd9Sstevel@tonic-gate *
1697c478bd9Sstevel@tonic-gate * removes entries form file that match the delete criteria
1707c478bd9Sstevel@tonic-gate */
file_deleteGssCredEntry(const gss_buffer_t name,const char * uid,char ** errDetails)1717c478bd9Sstevel@tonic-gate int file_deleteGssCredEntry(const gss_buffer_t name, const char *uid,
1727c478bd9Sstevel@tonic-gate char **errDetails)
1737c478bd9Sstevel@tonic-gate {
1747c478bd9Sstevel@tonic-gate FILE *fp, *tempFp;
1757c478bd9Sstevel@tonic-gate char entry[MAX_ENTRY_LEN+1];
1767c478bd9Sstevel@tonic-gate int foundOne = 0;
1777c478bd9Sstevel@tonic-gate
1787c478bd9Sstevel@tonic-gate /* are we deleting everyone? */
1797c478bd9Sstevel@tonic-gate if (name == NULL && uid == NULL) {
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gate if ((fp = fopen(credFile, "w")) == NULL) {
1827c478bd9Sstevel@tonic-gate
1837c478bd9Sstevel@tonic-gate if (errDetails) {
1847c478bd9Sstevel@tonic-gate (void) snprintf(entry, sizeof (entry),
1857c478bd9Sstevel@tonic-gate gettext("Unable to open gsscred"
1867c478bd9Sstevel@tonic-gate " file [%s]"),
1877c478bd9Sstevel@tonic-gate credFile);
1887c478bd9Sstevel@tonic-gate *errDetails = strdup(entry);
1897c478bd9Sstevel@tonic-gate }
1907c478bd9Sstevel@tonic-gate return (0);
1917c478bd9Sstevel@tonic-gate }
1927c478bd9Sstevel@tonic-gate
1937c478bd9Sstevel@tonic-gate (void) fclose(fp);
1947c478bd9Sstevel@tonic-gate return (1);
1957c478bd9Sstevel@tonic-gate }
1967c478bd9Sstevel@tonic-gate
1977c478bd9Sstevel@tonic-gate /* selective delete - might still be everyone */
1987c478bd9Sstevel@tonic-gate if ((fp = fopen(credFile, "r")) == NULL) {
1997c478bd9Sstevel@tonic-gate
2007c478bd9Sstevel@tonic-gate if (errDetails) {
2017c478bd9Sstevel@tonic-gate (void) snprintf(entry, sizeof (entry),
2027c478bd9Sstevel@tonic-gate gettext("Unable to open gsscred file [%s]"),
2037c478bd9Sstevel@tonic-gate credFile);
2047c478bd9Sstevel@tonic-gate *errDetails = strdup(entry);
2057c478bd9Sstevel@tonic-gate }
2067c478bd9Sstevel@tonic-gate return (0);
2077c478bd9Sstevel@tonic-gate }
2087c478bd9Sstevel@tonic-gate
2097c478bd9Sstevel@tonic-gate /* also need to open temp file */
2107c478bd9Sstevel@tonic-gate if ((tempFp = fopen(credFileTmp, "w")) == NULL) {
2117c478bd9Sstevel@tonic-gate if (errDetails) {
2127c478bd9Sstevel@tonic-gate (void) snprintf(entry, sizeof (entry),
2137c478bd9Sstevel@tonic-gate gettext("Unable to open gsscred temporary"
2147c478bd9Sstevel@tonic-gate " file [%s]"),
2157c478bd9Sstevel@tonic-gate credFileTmp);
2167c478bd9Sstevel@tonic-gate *errDetails = strdup(entry);
2177c478bd9Sstevel@tonic-gate }
2187c478bd9Sstevel@tonic-gate
2197c478bd9Sstevel@tonic-gate (void) fclose(fp);
2207c478bd9Sstevel@tonic-gate return (0);
2217c478bd9Sstevel@tonic-gate }
2227c478bd9Sstevel@tonic-gate
2237c478bd9Sstevel@tonic-gate /* go through all the entries sequentially removing ones that match */
2247c478bd9Sstevel@tonic-gate while (fgets(entry, MAX_ENTRY_LEN, fp) != NULL) {
2257c478bd9Sstevel@tonic-gate
2267c478bd9Sstevel@tonic-gate if (!matchEntry(entry, name, uid, NULL))
2277c478bd9Sstevel@tonic-gate (void) fputs(entry, tempFp);
2287c478bd9Sstevel@tonic-gate else
2297c478bd9Sstevel@tonic-gate foundOne = 1;
2307c478bd9Sstevel@tonic-gate }
2317c478bd9Sstevel@tonic-gate (void) fclose(tempFp);
2327c478bd9Sstevel@tonic-gate (void) fclose(fp);
2337c478bd9Sstevel@tonic-gate
2347c478bd9Sstevel@tonic-gate /* now make the tempfile the gsscred file */
2357c478bd9Sstevel@tonic-gate (void) rename(credFileTmp, credFile);
2367c478bd9Sstevel@tonic-gate (void) unlink(credFileTmp);
2377c478bd9Sstevel@tonic-gate
2387c478bd9Sstevel@tonic-gate if (!foundOne) {
2397c478bd9Sstevel@tonic-gate *errDetails = strdup(gettext("No users found"));
2407c478bd9Sstevel@tonic-gate return (0);
2417c478bd9Sstevel@tonic-gate }
2427c478bd9Sstevel@tonic-gate return (1);
2437c478bd9Sstevel@tonic-gate } /* file_deleteGssCredEntry */
2447c478bd9Sstevel@tonic-gate
2457c478bd9Sstevel@tonic-gate
2467c478bd9Sstevel@tonic-gate
2477c478bd9Sstevel@tonic-gate /*
2487c478bd9Sstevel@tonic-gate *
2497c478bd9Sstevel@tonic-gate * match entry
2507c478bd9Sstevel@tonic-gate *
2517c478bd9Sstevel@tonic-gate * checks if the specified entry matches the supplied criteria
2527c478bd9Sstevel@tonic-gate * returns 1 if yes, 0 if no
2537c478bd9Sstevel@tonic-gate * uidOut value can be used to retrieve the uid from the entry
2547c478bd9Sstevel@tonic-gate * when the uid string is passed in, the uidOut value is not set
2557c478bd9Sstevel@tonic-gate */
matchEntry(const char * entry,const gss_buffer_t name,const char * uid,uid_t * uidOut)2567c478bd9Sstevel@tonic-gate static int matchEntry(const char *entry, const gss_buffer_t name,
2577c478bd9Sstevel@tonic-gate const char *uid, uid_t *uidOut)
2587c478bd9Sstevel@tonic-gate {
259*ff22156cSsemery char fullEntry[MAX_ENTRY_LEN+1], *item, *item_buf, *name_buf;
2607c478bd9Sstevel@tonic-gate char dilims[] = "\t \n";
261*ff22156cSsemery /*
262*ff22156cSsemery * item_len is the length of the token in the gsscred_db.
263*ff22156cSsemery * name_len is the length of the token passed to this function.
264*ff22156cSsemery */
265*ff22156cSsemery int item_len, name_len;
266*ff22156cSsemery /*
267*ff22156cSsemery * This is the hex encoding of the beginning of all exported name
268*ff22156cSsemery * tokens for the Kerberos V mechanism. We need this to detect old,
269*ff22156cSsemery * incorrectly exported name tokens; see below.
270*ff22156cSsemery */
271*ff22156cSsemery char *krb5_ntok_prefix = "0401000B06092A864886F712010202";
272*ff22156cSsemery /*
273*ff22156cSsemery * This is the hex encoded GSS_C_NT_USER_NAME OID, needed for the same
274*ff22156cSsemery * reason as krb5_ntok_prefix.
275*ff22156cSsemery */
276*ff22156cSsemery char *gss_u_name = "2A864886F71201020101";
2777c478bd9Sstevel@tonic-gate
2787c478bd9Sstevel@tonic-gate if (entry == NULL || isspace(*entry))
2797c478bd9Sstevel@tonic-gate return (0);
2807c478bd9Sstevel@tonic-gate
2817c478bd9Sstevel@tonic-gate /* save the entry since strtok will chop it up */
2827c478bd9Sstevel@tonic-gate (void) strcpy(fullEntry, entry);
2837c478bd9Sstevel@tonic-gate
2847c478bd9Sstevel@tonic-gate if ((item = strtok(fullEntry, dilims)) == NULL)
2857c478bd9Sstevel@tonic-gate return (0);
2867c478bd9Sstevel@tonic-gate
287*ff22156cSsemery /* do we need to search the name */
2887c478bd9Sstevel@tonic-gate if (name != NULL) {
289*ff22156cSsemery
290*ff22156cSsemery item_len = strlen(item);
291*ff22156cSsemery name_len = name->length;
292*ff22156cSsemery name_buf = name->value;
293*ff22156cSsemery
2947c478bd9Sstevel@tonic-gate /* we can match the prefix of the string */
295*ff22156cSsemery if (item_len < name_len)
2967c478bd9Sstevel@tonic-gate return (0);
2977c478bd9Sstevel@tonic-gate
298*ff22156cSsemery if (strncmp(item, name->value, name_len) != 0) {
299ce79f9d5Sdh145677
300ce79f9d5Sdh145677 /*
301*ff22156cSsemery * The following section is needed in order to detect
302*ff22156cSsemery * two existing errant formats in the gsscred db.
303*ff22156cSsemery *
304*ff22156cSsemery * 1. Exported names that have a trailing null byte
305*ff22156cSsemery * ("00" in two hex characters) with the name length
306*ff22156cSsemery * incremented to account for the extra null byte.
307*ff22156cSsemery *
308*ff22156cSsemery * 2. Exported names that have the name type length
309*ff22156cSsemery * and name type OID prepended to the exported name.
310*ff22156cSsemery *
311ce79f9d5Sdh145677 */
312*ff22156cSsemery if (strncmp(name->value, krb5_ntok_prefix,
313*ff22156cSsemery strlen(krb5_ntok_prefix)) != 0)
314ce79f9d5Sdh145677 return (0);
315ce79f9d5Sdh145677
316*ff22156cSsemery if (strncmp(item, krb5_ntok_prefix,
317*ff22156cSsemery strlen(krb5_ntok_prefix)) != 0)
318*ff22156cSsemery return (0);
319ce79f9d5Sdh145677
320*ff22156cSsemery if ((item_buf = strstr(item, gss_u_name)) == NULL)
321*ff22156cSsemery return (0);
322*ff22156cSsemery
323*ff22156cSsemery item_buf += strlen(gss_u_name);
324*ff22156cSsemery
325*ff22156cSsemery name_buf += NAME_OFFSET;
326*ff22156cSsemery
327*ff22156cSsemery if ((strlen(item_buf) != strlen(name_buf)) &&
328*ff22156cSsemery (strncmp(item_buf + (strlen(item_buf) - 2), "00", 2)
329*ff22156cSsemery != 0))
330*ff22156cSsemery return (0);
331ce79f9d5Sdh145677
332ce79f9d5Sdh145677 /*
333*ff22156cSsemery * Here we compare the end of name_len, given
334*ff22156cSsemery * that item_len could have two extra "00"
335*ff22156cSsemery * representing the null byte.
336ce79f9d5Sdh145677 */
337*ff22156cSsemery if (strncmp(item_buf, name_buf, name_len - NAME_OFFSET)
338*ff22156cSsemery != 0)
339ce79f9d5Sdh145677 return (0);
340*ff22156cSsemery } else
341*ff22156cSsemery /*
342*ff22156cSsemery * We only strncmp() so we could check for old,
343*ff22156cSsemery * broken exported name tokens for the krb5 mech.
344*ff22156cSsemery * For any other exported name tokens we want exact
345*ff22156cSsemery * matches only.
346*ff22156cSsemery */
347*ff22156cSsemery if (item_len != name_len)
348ce79f9d5Sdh145677 return (0);
349ce79f9d5Sdh145677
3507c478bd9Sstevel@tonic-gate /* do we need to check the uid - if not then we found it */
3517c478bd9Sstevel@tonic-gate if (uid == NULL) {
3527c478bd9Sstevel@tonic-gate /* do we ned to parse out the uid ? */
3537c478bd9Sstevel@tonic-gate if (uidOut) {
3547c478bd9Sstevel@tonic-gate if ((item = strtok(NULL, dilims)) == NULL)
3557c478bd9Sstevel@tonic-gate return (0);
3567c478bd9Sstevel@tonic-gate *uidOut = atol(item);
3577c478bd9Sstevel@tonic-gate }
3587c478bd9Sstevel@tonic-gate return (1);
3597c478bd9Sstevel@tonic-gate }
3607c478bd9Sstevel@tonic-gate
3617c478bd9Sstevel@tonic-gate /* continue with checking the uid */
3627c478bd9Sstevel@tonic-gate }
3637c478bd9Sstevel@tonic-gate
3647c478bd9Sstevel@tonic-gate if (uid == NULL)
3657c478bd9Sstevel@tonic-gate return (1);
3667c478bd9Sstevel@tonic-gate
3677c478bd9Sstevel@tonic-gate /* get the next token from the string - the uid */
3687c478bd9Sstevel@tonic-gate if ((item = strtok(NULL, dilims)) == NULL)
3697c478bd9Sstevel@tonic-gate return (0);
3707c478bd9Sstevel@tonic-gate
3717c478bd9Sstevel@tonic-gate if (strcmp(item, uid) == 0)
3727c478bd9Sstevel@tonic-gate return (1);
3737c478bd9Sstevel@tonic-gate
3747c478bd9Sstevel@tonic-gate return (0);
3757c478bd9Sstevel@tonic-gate } /* ******* matchEntry ****** */
376