mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
userok: Allow NULL components in kerberosSuperUser
Modify kerberosSuperUser so that it can support callers passing NULL, rather than just empty, instance and cell strings Change-Id: Ifc21eb0c4f562d65519e31db32723c3a2d19b363 Reviewed-on: http://gerrit.openafs.org/3351 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
e6a2183f0c
commit
eee9fe0945
@ -340,7 +340,7 @@ static int
|
|||||||
kerberosSuperUser(struct afsconf_dir *adir, char *tname, char *tinst,
|
kerberosSuperUser(struct afsconf_dir *adir, char *tname, char *tinst,
|
||||||
char *tcell, char *namep)
|
char *tcell, char *namep)
|
||||||
{
|
{
|
||||||
char tcell_l[MAXKTCREALMLEN];
|
char tcell_l[MAXKTCREALMLEN] = "";
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
/* keep track of which one actually authorized request */
|
/* keep track of which one actually authorized request */
|
||||||
@ -353,11 +353,13 @@ kerberosSuperUser(struct afsconf_dir *adir, char *tname, char *tinst,
|
|||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
/* generate lowercased version of cell name */
|
/* generate lowercased version of cell name */
|
||||||
strcpy(tcell_l, tcell);
|
if (tcell) {
|
||||||
tmp = tcell_l;
|
strcpy(tcell_l, tcell);
|
||||||
while (*tmp) {
|
tmp = tcell_l;
|
||||||
*tmp = tolower(*tmp);
|
while (*tmp) {
|
||||||
tmp++;
|
*tmp = tolower(*tmp);
|
||||||
|
tmp++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* determine local cell name. It's static, so will only get
|
/* determine local cell name. It's static, so will only get
|
||||||
@ -394,7 +396,7 @@ kerberosSuperUser(struct afsconf_dir *adir, char *tname, char *tinst,
|
|||||||
/* If yes, then make sure that the name is not present in
|
/* If yes, then make sure that the name is not present in
|
||||||
* an exclusion list */
|
* an exclusion list */
|
||||||
if (lrealm_match) {
|
if (lrealm_match) {
|
||||||
if (tinst[0])
|
if (tinst && tinst[0])
|
||||||
snprintf(uname,sizeof(uname),"%s.%s@%s",tname,tinst,tcell);
|
snprintf(uname,sizeof(uname),"%s.%s@%s",tname,tinst,tcell);
|
||||||
else
|
else
|
||||||
snprintf(uname,sizeof(uname),"%s@%s",tname,tcell);
|
snprintf(uname,sizeof(uname),"%s@%s",tname,tcell);
|
||||||
@ -408,7 +410,8 @@ kerberosSuperUser(struct afsconf_dir *adir, char *tname, char *tinst,
|
|||||||
flag = 0;
|
flag = 0;
|
||||||
|
|
||||||
/* localauth special case */
|
/* 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)) {
|
&& !strcmp(tname, AUTH_SUPERUSER)) {
|
||||||
strcpy(uname, "<LocalAuth>");
|
strcpy(uname, "<LocalAuth>");
|
||||||
flag = 1;
|
flag = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user