src/usr.sbin/mountd/mountd.c
/*
 * Parse a colon separated list of security flavors
 */
Parse a colon separated list of security flavors
Parse a colon separated list of security flavors
static int
parsesec(char *seclist, struct exportlist *ep)
{
	char *cp, savedc;
	int flavor;
	ep->ex_numsecflavors = 0;
	for (;;) {
		cp = strchr(seclist, ':');
		if (cp) {
			savedc = *cp;
			*cp = '\0';
		}
		if (!strcmp(seclist, "sys"))
			flavor = AUTH_SYS;
		else if (!strcmp(seclist, "krb5"))
			flavor = RPCSEC_GSS_KRB5;
		else if (!strcmp(seclist, "krb5i"))
			flavor = RPCSEC_GSS_KRB5I;
		else if (!strcmp(seclist, "krb5p"))
			flavor = RPCSEC_GSS_KRB5P;
		else {
			if (cp)
				*cp = savedc;
			syslog(LOG_ERR, "bad sec flavor: %s", seclist);
			return (1);
		}
		if (ep->ex_numsecflavors == MAXSECFLAVORS) {
			if (cp)
				*cp = savedc;
			syslog(LOG_ERR, "too many sec flavors: %s", seclist);
			return (1);
		}
		ep->ex_secflavors[ep->ex_numsecflavors] = flavor;
		ep->ex_numsecflavors++;
		if (cp) {
			*cp = savedc;
			seclist = cp + 1;
		} else {
			break;
		}
	}
	return (0);
}
static int parsesec ( char * seclist , struct exportlist * ep ) { char * cp , savedc ; int flavor ; ep -> ex_numsecflavors = 0 ; for ( ; ; ) { cp = strchr ( seclist , ' ' ) ; if ( cp ) { savedc = * cp ; * cp = ' \0 ' ; } if ( ! strcmp ( seclist , " " ) ) flavor = AUTH_SYS ; else if ( ! strcmp ( seclist , " " ) ) flavor = RPCSEC_GSS_KRB5 ; else if ( ! strcmp ( seclist , " " ) ) flavor = RPCSEC_GSS_KRB5I ; else if ( ! strcmp ( seclist , " " ) ) flavor = RPCSEC_GSS_KRB5P ; else { if ( cp ) * cp = savedc ; syslog ( LOG_ERR , " " , seclist ) ; return ( 1 ) ; } if ( ep -> ex_numsecflavors == MAXSECFLAVORS ) { if ( cp ) * cp = savedc ; syslog ( LOG_ERR , " " , seclist ) ; return ( 1 ) ; } ep -> ex_secflavors [ ep -> ex_numsecflavors ] = flavor ; ep -> ex_numsecflavors ++ ; if ( cp ) { * cp = savedc ; seclist = cp + 1 ; } else { break ; } } return ( 0 ) ; }
Parse a colon separated list of security flavors
Parse a colon separated list of security flavors