summaryrefslogtreecommitdiffstats
path: root/src/kdc
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>1997-08-18 16:33:45 +0000
committerEzra Peisach <epeisach@mit.edu>1997-08-18 16:33:45 +0000
commitcea7f38cafdec202a13e37cf27ffd25c488deb48 (patch)
tree252dbdd83e9796c2ca520a493edad50a64b33db1 /src/kdc
parent07d5604905ea9de035ddfb347a02355e5f230f99 (diff)
downloadkrb5-cea7f38cafdec202a13e37cf27ffd25c488deb48.tar.gz
krb5-cea7f38cafdec202a13e37cf27ffd25c488deb48.tar.xz
krb5-cea7f38cafdec202a13e37cf27ffd25c488deb48.zip
* kdc_util.h: Added prototype for setup_server_realm(). This function
is used in several files. * main.c (get_realm_port): Removed unused function. (setup_server_realm): Moved prototype to kdc_util.h git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10182 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/kdc')
-rw-r--r--src/kdc/ChangeLog7
-rw-r--r--src/kdc/kdc_util.h2
-rw-r--r--src/kdc/main.c112
3 files changed, 9 insertions, 112 deletions
diff --git a/src/kdc/ChangeLog b/src/kdc/ChangeLog
index 752935715..ccf06b798 100644
--- a/src/kdc/ChangeLog
+++ b/src/kdc/ChangeLog
@@ -1,3 +1,10 @@
+Mon Aug 18 12:29:08 1997 Ezra Peisach <epeisach@kangaroo.mit.edu>
+
+ * kdc_util.h: Added prototype for setup_server_realm().
+
+ * main.c (get_realm_port): Removed unused function.
+ (setup_server_realm): Moved prototype to kdc_util.h
+
Wed Jul 30 18:29:19 1997 Tom Yu <tlyu@mit.edu>
* kdc_util.c:
diff --git a/src/kdc/kdc_util.h b/src/kdc/kdc_util.h
index 27d62d43b..2702e14d2 100644
--- a/src/kdc/kdc_util.h
+++ b/src/kdc/kdc_util.h
@@ -115,6 +115,8 @@ krb5_error_code dispatch PROTOTYPE((krb5_data *,
/* main.c */
krb5_error_code kdc_initialize_rcache PROTOTYPE((krb5_context, char *));
+krb5_error_code setup_server_realm PROTOTYPE((krb5_principal));
+
/* network.c */
krb5_error_code listen_and_process PROTOTYPE((const char *));
krb5_error_code setup_network PROTOTYPE((const char *));
diff --git a/src/kdc/main.c b/src/kdc/main.c
index 217556649..5fca363e5 100644
--- a/src/kdc/main.c
+++ b/src/kdc/main.c
@@ -43,8 +43,6 @@
kdc_realm_t *find_realm_data PROTOTYPE((char *, krb5_ui_4));
-krb5_error_code setup_server_realm PROTOTYPE((krb5_principal));
-
void usage PROTOTYPE((char *));
krb5_sigtype request_exit PROTOTYPE((int));
@@ -62,116 +60,6 @@ static int rkey_init_done = 0;
#define KRB5_KDC_MAX_REALMS 32
/*
- * Get port information for a realm. The precedence is:
- * [realms]-><realm>-><name> in profile (if our hostname and has a port)
- * defport
- * /etc/services entry matching <service>
- */
-static krb5_int32
-get_realm_port(ctx, realm, name, defport, service)
- krb5_context ctx;
- char *realm;
- char *name;
- krb5_int32 defport;
- char *service;
-{
- krb5_error_code kret;
- char our_host_name[MAXHOSTNAMELEN];
- struct hostent *our_hostent;
- struct servent *our_servent;
- krb5_int32 retval;
- krb5_boolean found;
-
- /*
- * Some preliminaries here. Get our hostname and our host entry.
- */
- found = 0;
- retval = -1;
- if (!gethostname(our_host_name, sizeof(our_host_name)) &&
- (our_hostent = gethostbyname(our_host_name))) {
- const char *hierarchy[4];
- char **hostlist;
-
- hostlist = (char **) NULL;
- hierarchy[0] = "realms";
- hierarchy[1] = realm;
- hierarchy[2] = name;
- hierarchy[3] = (char *) NULL;
- if (!(kret = profile_get_values(ctx->profile, hierarchy, &hostlist))) {
- int hi;
- char *cport;
- char *cp;
- int ai;
- krb5_int32 pport;
-
- cport = (char *) NULL;
- for (hi=0; hostlist[hi]; hi++) {
- /*
- * This knows a little too much about the format of profile
- * entries. Shouldn't it just be some sort of tuple?
- *
- * The form is assumed to be:
- * <name> = <hostname>[:<portname>[<whitespace>]]
- */
- pport = -1;
- cp = strchr(hostlist[hi], ' ');
- if (cp)
- *cp = '\0';
- cp = strchr(hostlist[hi], '\t');
- if (cp)
- *cp = '\0';
- cport = strchr(hostlist[hi], ':');
- if (cport) {
- *cport = '\0';
- cport++;
- if (sscanf(cport, "%d", &pport) == 1) {
- pport = -1;
- }
- }
- /*
- * We've stripped away the crud. Now check to see if the
- * profile entry matches our hostname. If so, then this
- * is the one to use. Additionally, check the host alias
- * list.
- */
- if (!strcmp(hostlist[hi], our_hostent->h_name)) {
- if (pport != -1) {
- retval = pport;
- found = 1;
- }
- }
- else {
- for (ai=0; our_hostent->h_aliases[ai]; ai++) {
- if (!strcmp(hostlist[hi],
- our_hostent->h_aliases[ai])) {
- if (pport != -1) {
- retval = pport;
- found = 1;
- }
- break;
- }
- }
- }
- }
- free(hostlist);
- }
- }
- /*
- * If we didn't find an entry in the profile, then use the default.
- * If it's no good, then attempt to find it in /etc/services.
- */
- if (!found) {
- retval = defport;
- /* Get the service entry out of /etc/services */
- if (retval <= 0) {
- if ((our_servent = getservbyname(service, "udp")))
- retval = ntohs(our_servent->s_port);
- }
- }
- return(retval);
-}
-
-/*
* initialize the replay cache.
*/
krb5_error_code