Start using resolve again.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4568 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -143,11 +143,10 @@ kafs_settoken(const char *cell, uid_t uid, CREDENTIALS *c)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Try to get a db-server for an AFS cell from a AFSDB record */
|
/* Try to get a db-server for an AFS cell from a AFSDB record */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dns_find_cell(const char *cell, char *dbserver)
|
dns_find_cell(const char *cell, char *dbserver, size_t len)
|
||||||
{
|
{
|
||||||
struct dns_reply *r;
|
struct dns_reply *r;
|
||||||
int ok = -1;
|
int ok = -1;
|
||||||
@@ -156,8 +155,8 @@ dns_find_cell(const char *cell, char *dbserver)
|
|||||||
struct resource_record *rr = r->head;
|
struct resource_record *rr = r->head;
|
||||||
while(rr){
|
while(rr){
|
||||||
if(rr->type == T_AFSDB && rr->u.afsdb->preference == 1){
|
if(rr->type == T_AFSDB && rr->u.afsdb->preference == 1){
|
||||||
strncpy(dbserver, rr->u.afsdb->domain, MaxHostNameLen);
|
strncpy(dbserver, rr->u.afsdb->domain, len);
|
||||||
dbserver[MaxHostNameLen - 1] = 0;
|
dbserver[len - 1] = '\0';
|
||||||
ok = 0;
|
ok = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -167,7 +166,6 @@ dns_find_cell(const char *cell, char *dbserver)
|
|||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -260,40 +258,33 @@ 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)) {
|
||||||
while (fgets(buf, sizeof(buf), F))
|
|
||||||
{
|
|
||||||
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)
|
if (strncmp(buf + 1, cell, strlen(cell)) == 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
|
||||||
*/
|
*/
|
||||||
if (fgets(buf, sizeof(buf), F) == NULL)
|
if (fgets(buf, sizeof(buf), F) == NULL)
|
||||||
break; /* Read failed, give up */
|
break; /* Read failed, give up */
|
||||||
p = strchr(buf, '#');
|
p = strchr(buf, '#');
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
break; /* No '#', give up */
|
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);
|
||||||
if (*realm && **realm != 0)
|
if (*realm && **realm != '\0')
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break; /* Won't try any more */
|
break; /* Won't try any more */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(F);
|
fclose(F);
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
if (realm == NULL) {
|
|
||||||
if (dns_find_cell(cell, buf) == 0)
|
|
||||||
realm = krb_realmofhost(buf);
|
|
||||||
}
|
}
|
||||||
#endif
|
if (*realm == NULL && dns_find_cell(cell, buf, sizeof(buf)) == 0)
|
||||||
|
*realm = strdup(krb_realmofhost(buf));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <kafs.h>
|
#include <kafs.h>
|
||||||
|
|
||||||
/* #include <resolve.h> */
|
#include <resolve.h>
|
||||||
|
|
||||||
#include "afssysdefs.h"
|
#include "afssysdefs.h"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user