* kdc_util.h: Added prototype for setup_server_realm(). This function
authorEzra Peisach <epeisach@mit.edu>
Mon, 18 Aug 1997 16:33:45 +0000 (16:33 +0000)
committerEzra Peisach <epeisach@mit.edu>
Mon, 18 Aug 1997 16:33:45 +0000 (16:33 +0000)
  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

src/kdc/ChangeLog
src/kdc/kdc_util.h
src/kdc/main.c

index 75293571558f00553d15e98ea319121d4047a5cf..ccf06b798f981eb326d71b7e7d6ceef41189a3be 100644 (file)
@@ -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: 
index 27d62d43b72896d0abfebdeb9134d31568dacb21..2702e14d234c4a90751fa9fa1799b3a006229f91 100644 (file)
@@ -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 *));
index 2175566497d09321ed23f7d9514768339ad835e4..5fca363e5fbd8bb9301f192dafc36705696793b3 100644 (file)
@@ -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));
@@ -61,116 +59,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.
  */