kerberosSuperUser(struct afsconf_dir *adir, char *tname, char *tinst,
char *tcell, char *namep)
{
- char tcell_l[MAXKTCREALMLEN];
+ char tcell_l[MAXKTCREALMLEN] = "";
char *tmp;
/* keep track of which one actually authorized request */
int flag;
/* generate lowercased version of cell name */
- strcpy(tcell_l, tcell);
- tmp = tcell_l;
- while (*tmp) {
- *tmp = tolower(*tmp);
- tmp++;
+ if (tcell) {
+ strcpy(tcell_l, tcell);
+ tmp = tcell_l;
+ while (*tmp) {
+ *tmp = tolower(*tmp);
+ tmp++;
+ }
}
/* determine local cell name. It's static, so will only get
/* If yes, then make sure that the name is not present in
* an exclusion list */
if (lrealm_match) {
- if (tinst[0])
+ if (tinst && tinst[0])
snprintf(uname,sizeof(uname),"%s.%s@%s",tname,tinst,tcell);
else
snprintf(uname,sizeof(uname),"%s@%s",tname,tcell);
flag = 0;
/* localauth special case */
- if (strlen(tinst) == 0 && strlen(tcell) == 0
+ if ((tinst == NULL || strlen(tinst) == 0) &&
+ (tcell == NULL || strlen(tcell) == 0)
&& !strcmp(tname, AUTH_SUPERUSER)) {
strcpy(uname, "<LocalAuth>");
flag = 1;