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