]> andersk Git - moira.git/blobdiff - reg_svr/admin_call.c
made the server to connect to an argument to sms_connect.
[moira.git] / reg_svr / admin_call.c
index ecbcc2c7e7359c9d7a1aabcfb2befc9d4c954e22..c543e8b62b5314b3aaadb0aff240a9ca84d9703b 100644 (file)
@@ -4,6 +4,8 @@
  *     $Header$
  *
  *     Copyright (C) 1987 by the Massachusetts Institute of Technology
+ *     For copying and distribution information, please see the file
+ *     <mit-copyright.h>.
  *
  *     Utility functions for communication with the Kerberos admin_server
  *
@@ -16,6 +18,7 @@
 static char *rcsid_admin_call_c = "$Header$";
 #endif lint
 
+#include <mit-copyright.h>
 #include <sys/errno.h>
 #include <sys/types.h>
 #include <sys/time.h>
@@ -25,6 +28,7 @@ static char *rcsid_admin_call_c = "$Header$";
 
 #include <netdb.h>
 #include <strings.h>
+#include <ctype.h>
 #include <stdio.h>
 
 #include "admin_err.h"
@@ -91,6 +95,16 @@ int admin_call_init()
        bcopy((char *)hp->h_addr, (char *)&admin_addr.sin_addr, hp->h_length);
        admin_addr.sin_port = sp->s_port;
 
+       /* lowercase & truncate hostname becuase it will be used as an
+        * instance name.
+        */
+        {
+           char *s;
+           for (s = krbhost; *s && *s != '.'; s++)
+               if (isupper(*s))
+                   *s = tolower(*s);
+           *s = 0;
+       }
        inited = 1;
     }
     return 0;
@@ -182,7 +196,7 @@ admin_call(opcode, pname, old_passwd, new_passwd, crypt_passwd)
      * find our session key.
      */
 
-    if (status = krb_get_cred("changepw", "kerberos", krbrlm, &cred)) {
+    if (status = krb_get_cred("changepw", krbhost, krbrlm, &cred)) {
        status += krb_err_base;
        goto bad;
     }
@@ -252,7 +266,7 @@ admin_call(opcode, pname, old_passwd, new_passwd, crypt_passwd)
      * and know who we are.
      */
 
-    if (status = krb_mk_req(&authent, "changepw", "kerberos", krbrlm,
+    if (status = krb_mk_req(&authent, "changepw", krbhost, krbrlm,
                           checksum)) {
        status += krb_err_base;
        goto bad;
This page took 0.7018 seconds and 4 git commands to generate.