Could no longer figure out that
AFS cell pdc.kth.se uses service principal afs.pdc.kth.se@NADA.KTH.SE. Now fixed. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3770 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -223,6 +223,8 @@ _kafs_afslog_all_local_cells(kafs_data *data, uid_t uid)
|
|||||||
|
|
||||||
This does not work when the VL-server is living in one realm, but
|
This does not work when the VL-server is living in one realm, but
|
||||||
the cell it is serving is living in another realm.
|
the cell it is serving is living in another realm.
|
||||||
|
|
||||||
|
Return 0 on success, -1 otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -233,28 +235,37 @@ realm_of_cell(kafs_data *data, const char *cell, char **realm)
|
|||||||
char *p;
|
char *p;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if((F = fopen(_PATH_CELLSERVDB, "r"))){
|
if ((F = fopen(_PATH_CELLSERVDB, "r")))
|
||||||
while(fgets(buf, sizeof(buf), F)){
|
{
|
||||||
if(buf[0] != '>')
|
while (fgets(buf, sizeof(buf), F))
|
||||||
continue;
|
{
|
||||||
if(strncmp(buf + 1, cell, strlen(cell)) == 0){
|
if (buf[0] != '>')
|
||||||
if(fgets(buf, sizeof(buf), F) == NULL)
|
continue; /* Not a cell name line, try next line */
|
||||||
break;
|
if (strncmp(buf + 1, cell, strlen(cell)) == 0)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* We found the cell name we're looking for.
|
||||||
|
* Read next line on the form ip-address '#' hostname
|
||||||
|
*/
|
||||||
|
if (fgets(buf, sizeof(buf), F) == NULL)
|
||||||
|
break; /* Read failed, give up */
|
||||||
p = strchr(buf, '#');
|
p = strchr(buf, '#');
|
||||||
if(p == NULL)
|
if (p == NULL)
|
||||||
break;
|
break; /* No '#', give up */
|
||||||
p++;
|
p++;
|
||||||
if(buf[strlen(buf) - 1] == '\n')
|
if (buf[strlen(buf) - 1] == '\n')
|
||||||
buf[strlen(buf) - 1] = 0;
|
buf[strlen(buf) - 1] = 0;
|
||||||
*realm = (*data->get_realm)(data, p);
|
*realm = (*data->get_realm)(data, p);
|
||||||
break;
|
if (*realm && **realm != 0)
|
||||||
}
|
ret = 0;
|
||||||
}
|
break; /* Won't try any more */
|
||||||
|
}
|
||||||
|
}
|
||||||
fclose(F);
|
fclose(F);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
if(realm == NULL){
|
if (realm == NULL) {
|
||||||
if(dns_find_cell(cell, buf) == 0)
|
if (dns_find_cell(cell, buf) == 0)
|
||||||
realm = krb_realmofhost(buf);
|
realm = krb_realmofhost(buf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -297,32 +308,31 @@ _kafs_get_cred(kafs_data *data,
|
|||||||
* blondino and she might as well have it.)
|
* blondino and she might as well have it.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(krealm){
|
if (krealm) {
|
||||||
ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, krealm, c);
|
ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, krealm, c);
|
||||||
if(ret == 0) return 0;
|
if (ret == 0) return 0;
|
||||||
ret = (*data->get_cred)(data, AUTH_SUPERUSER, "", krealm, c);
|
ret = (*data->get_cred)(data, AUTH_SUPERUSER, "", krealm, c);
|
||||||
}
|
}
|
||||||
if(ret == 0) return 0;
|
if (ret == 0) return 0;
|
||||||
|
|
||||||
foldup(CELL, cell);
|
foldup(CELL, cell);
|
||||||
|
|
||||||
ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, CELL, c);
|
ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, CELL, c);
|
||||||
if(ret == 0) return 0;
|
if (ret == 0) return 0;
|
||||||
|
|
||||||
ret = (*data->get_cred)(data, AUTH_SUPERUSER, "", CELL, c);
|
ret = (*data->get_cred)(data, AUTH_SUPERUSER, "", CELL, c);
|
||||||
if(ret == 0) return 0;
|
if (ret == 0) return 0;
|
||||||
|
|
||||||
/* this might work in some cases */
|
/* this might work in some cases */
|
||||||
if(realm_of_cell(data, cell, &vl_realm) == 0){
|
if (realm_of_cell(data, cell, &vl_realm) == 0) {
|
||||||
char *vl_realm;
|
|
||||||
ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, vl_realm, c);
|
ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, vl_realm, c);
|
||||||
if(ret)
|
if (ret)
|
||||||
ret = (*data->get_cred)(data, AUTH_SUPERUSER, "", vl_realm, c);
|
ret = (*data->get_cred)(data, AUTH_SUPERUSER, "", vl_realm, c);
|
||||||
free(vl_realm);
|
free(vl_realm);
|
||||||
if(ret == 0) return 0;
|
if (ret == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lrealm)
|
if (lrealm)
|
||||||
ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, lrealm, c);
|
ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, lrealm, c);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user