(_kafs_realm_of_cell): changed to first try exact match in CellServDB,
then exact match in DNS, and finally in-exact match in CellServDB git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10128 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 1998, 1999 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -250,18 +250,8 @@ _kafs_afslog_all_local_cells(kafs_data *data, uid_t uid, const char *homedir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Find the realm associated with cell. Do this by opening
|
static int
|
||||||
/usr/vice/etc/CellServDB and getting the realm-of-host for the
|
file_find_cell(kafs_data *data, const char *cell, char **realm, int exact)
|
||||||
first VL-server for the cell.
|
|
||||||
|
|
||||||
This does not work when the VL-server is living in one realm, but
|
|
||||||
the cell it is serving is living in another realm.
|
|
||||||
|
|
||||||
Return 0 on success, -1 otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
_kafs_realm_of_cell(kafs_data *data, const char *cell, char **realm)
|
|
||||||
{
|
{
|
||||||
FILE *F;
|
FILE *F;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
@@ -271,9 +261,19 @@ _kafs_realm_of_cell(kafs_data *data, const char *cell, char **realm)
|
|||||||
if ((F = fopen(_PATH_CELLSERVDB, "r"))
|
if ((F = fopen(_PATH_CELLSERVDB, "r"))
|
||||||
|| (F = fopen(_PATH_ARLA_CELLSERVDB, "r"))) {
|
|| (F = fopen(_PATH_ARLA_CELLSERVDB, "r"))) {
|
||||||
while (fgets(buf, sizeof(buf), F)) {
|
while (fgets(buf, sizeof(buf), F)) {
|
||||||
|
int cmp;
|
||||||
|
|
||||||
if (buf[0] != '>')
|
if (buf[0] != '>')
|
||||||
continue; /* Not a cell name line, try next line */
|
continue; /* Not a cell name line, try next line */
|
||||||
if (strncmp(buf + 1, cell, strlen(cell)) == 0) {
|
p = buf;
|
||||||
|
strsep(&p, " \t\n#");
|
||||||
|
|
||||||
|
if (exact)
|
||||||
|
cmp = strcmp(buf + 1, cell);
|
||||||
|
else
|
||||||
|
cmp = strncmp(buf + 1, cell, strlen(cell));
|
||||||
|
|
||||||
|
if (cmp == 0) {
|
||||||
/*
|
/*
|
||||||
* We found the cell name we're looking for.
|
* We found the cell name we're looking for.
|
||||||
* Read next line on the form ip-address '#' hostname
|
* Read next line on the form ip-address '#' hostname
|
||||||
@@ -294,14 +294,36 @@ _kafs_realm_of_cell(kafs_data *data, const char *cell, char **realm)
|
|||||||
}
|
}
|
||||||
fclose(F);
|
fclose(F);
|
||||||
}
|
}
|
||||||
if (*realm == NULL && dns_find_cell(cell, buf, sizeof(buf)) == 0) {
|
|
||||||
*realm = strdup(krb_realmofhost(buf));
|
|
||||||
if(*realm != NULL)
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find the realm associated with cell. Do this by opening
|
||||||
|
/usr/vice/etc/CellServDB and getting the realm-of-host for the
|
||||||
|
first VL-server for the cell.
|
||||||
|
|
||||||
|
This does not work when the VL-server is living in one realm, but
|
||||||
|
the cell it is serving is living in another realm.
|
||||||
|
|
||||||
|
Return 0 on success, -1 otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
_kafs_realm_of_cell(kafs_data *data, const char *cell, char **realm)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = file_find_cell(data, cell, realm, 1);
|
||||||
|
if (ret == 0)
|
||||||
|
return ret;
|
||||||
|
if (dns_find_cell(cell, buf, sizeof(buf)) == 0) {
|
||||||
|
*realm = (*data->get_realm)(data, buf);
|
||||||
|
if(*realm != NULL)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return file_find_cell(data, cell, realm, 0);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_kafs_get_cred(kafs_data *data,
|
_kafs_get_cred(kafs_data *data,
|
||||||
const char *cell,
|
const char *cell,
|
||||||
|
Reference in New Issue
Block a user