Changes to conform with API modifications
authorTheodore Tso <tytso@mit.edu>
Thu, 21 Feb 1991 11:48:26 +0000 (11:48 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 21 Feb 1991 11:48:26 +0000 (11:48 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1753 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb425/425data.c
src/lib/krb425/kntoln.c
src/lib/krb425/krb425.h
src/lib/krb425/rd_req.c
src/lib/krb425/realmhost.c

index 796fad3e382f2629d6aa128c82b5b3493e1461d7..b3b4fcd4a30adc795b3240a645d67ae6d546a518 100644 (file)
@@ -18,7 +18,7 @@ static char rcsid_425data_c[] =
 #include <krb5/copyright.h>
 #include "krb425.h"
 
-char                   _krb425_local_realm[REALM_SZ+1] = { 0 };
+char                   *krb425_local_realm = 0;
 krb5_ccache            _krb425_ccache = 0;
 int                    _krb425_error_init = 0;
 
index 2a4c8c2f9ec08f1fd37794d6d3cb13cf4a2723df..250368ca63d38031340c07246f4fb039edc50bad 100644 (file)
@@ -23,8 +23,11 @@ krb_kntoln(ad,lname)
 AUTH_DAT *ad;
 char *lname;
 {
-       if (!_krb425_local_realm[0])
-               krb5_get_default_realm(REALM_SZ, _krb425_local_realm);
+       krb5_error_code retval;
+       
+       if (!_krb425_local_realm)
+               if (retval = krb5_get_default_realm(&_krb425_local_realm))
+                       return(krb425error(retval));
 
        if (strcmp(ad->pinst,""))
                return(KFAILURE);
index 0d3939f070fcfa616d6f4bec6d9c35e5fd98dba4..0b5d6f9b9ca7a6fc0235798c4836f62b076fdea9 100644 (file)
@@ -46,7 +46,7 @@
                str[0] = 0; \
 }
 
-extern char            _krb425_local_realm[REALM_SZ+1];
+extern char            *_krb425_local_realm;
 extern krb5_ccache     _krb425_ccache;
 extern int             _krb425_error_init;
 
index f34156bb454683689eefba7db78148014dcd8feb..6403ad13f628be974bd1a9f7fb146e897b6f25a8 100644 (file)
@@ -28,7 +28,7 @@ AUTH_DAT *ad;
 char *fn;
 {
        krb5_address peer;
-       krb5_tkt_authent authd;
+       krb5_tkt_authent *authdat;
        char addr[4];
        krb5_data *server[4];
        krb5_data srvdata[3];
@@ -44,8 +44,9 @@ char *fn;
                memcpy(addr, (char *)&from_addr + (sizeof(from_addr) - 4), 4);
        }
 
-       if (!_krb425_local_realm[0])
-               krb5_get_default_realm(REALM_SZ, _krb425_local_realm);
+       if (!_krb425_local_realm)
+               if (r = krb5_get_default_realm(&_krb425_local_realm))
+                       return(krb425error(r));
 
        if (!strcmp(instance, "*")) {
                static char hostname[64] = { 0 };
@@ -111,7 +112,7 @@ char *fn;
        if (r = krb5_rd_req(&authe,
                            (krb5_principal)server,
                            from_addr ? &peer : 0,
-                           fn, 0, 0, 0, &authd)) {
+                           fn, 0, 0, 0, &authdat)) {
 #ifdef EBUG
                ERROR(r)
 #endif
@@ -122,52 +123,51 @@ char *fn;
 
 #ifdef EBUG
        r = 0;
-       while (authd.authenticator->client[r]) {
-               EPRINT "Client[%d]: ", r); show5((*authd.authenticator->client[r])); ENEWLINE
+       while (authdat->authenticator->client[r]) {
+               EPRINT "Client[%d]: ", r); show5((*authdat->authenticator->client[r])); ENEWLINE
                ++r;
        }
        r = 0;
-       while (authd.ticket->server[r]) {
-               EPRINT "Server[%d]: ", r); show5((*authd.ticket->server[r])); ENEWLINE
+       while (authdat->ticket->server[r]) {
+               EPRINT "Server[%d]: ", r); show5((*authdat->ticket->server[r])); ENEWLINE
                ++r;
        }
        r = 0;
 #endif
-       set_string(ad->pname, ANAME_SZ, authd.authenticator->client[1]);
-       set_string(ad->pinst, INST_SZ, authd.authenticator->client[2]);
-       set_string(ad->prealm, REALM_SZ, authd.authenticator->client[0]);
+       set_string(ad->pname, ANAME_SZ, authdat->authenticator->client[1]);
+       set_string(ad->pinst, INST_SZ, authdat->authenticator->client[2]);
+       set_string(ad->prealm, REALM_SZ, authdat->authenticator->client[0]);
 
-       ad->checksum = *(long *)authd.authenticator->checksum->contents;
+       ad->checksum = *(long *)authdat->authenticator->checksum->contents;
 
-       if (authd.ticket->enc_part2->session->keytype != KEYTYPE_DES) {
+       if (authdat->ticket->enc_part2->session->keytype != KEYTYPE_DES) {
                r = KFAILURE;
                goto out;
        } else
                memcpy((char*)ad->session,
-                      (char*)authd.ticket->enc_part2->session->contents,
+                      (char*)authdat->ticket->enc_part2->session->contents,
                       sizeof(C_Block));
 
-       ad->life = authd.ticket->enc_part2->times.endtime;
-       ad->time_sec = authd.authenticator->ctime;
+       ad->life = authdat->ticket->enc_part2->times.endtime;
+       ad->time_sec = authdat->authenticator->ctime;
        ad->address = 0;
 
-       if (authd.ticket->enc_part2->caddrs[0]->addrtype != ADDRTYPE_INET) {
+       if (authdat->ticket->enc_part2->caddrs[0]->addrtype != ADDRTYPE_INET) {
                r = KFAILURE;
                goto out;
        } else
                memcpy((char*)&ad->address + sizeof(ad->address) - 4,
-                      (char*)authd.ticket->enc_part2->caddrs[0]->contents, 4);
+                      (char*)authdat->ticket->enc_part2->caddrs[0]->contents, 4);
 
-       if (authd.ticket->enc_part2->authorization_data &&
-           authd.ticket->enc_part2->authorization_data[0]) {
-               ad->reply.length = authd.ticket->enc_part2->authorization_data[0]->length;
+       if (authdat->ticket->enc_part2->authorization_data &&
+           authdat->ticket->enc_part2->authorization_data[0]) {
+               ad->reply.length = authdat->ticket->enc_part2->authorization_data[0]->length;
                memcpy((char*)ad->reply.dat,
-                      (char*)authd.ticket->enc_part2->authorization_data[0]->contents,
+                      (char*)authdat->ticket->enc_part2->authorization_data[0]->contents,
                       min(ad->reply.length, MAX_KTXT_LEN));
                ad->reply.mbz = 0;
        }
 out:
-       krb5_free_ticket(authd.ticket);
-       krb5_free_authenticator(authd.authenticator);
+       krb5_free_tkt_authent(authdat);
        return(r);
 }
index 2f600c6ebb1cbf1c116434dbe8541c644f681625..d7d2f9eff520c31f94f227c098859276b7671d2d 100644 (file)
@@ -40,8 +40,14 @@ char *host;
                         if (islower(*cp))
                                 *cp = toupper(*cp);
         } else {
-               if (krb5_get_default_realm(REALM_SZ, ret_realm))
-                       ret_realm[0] = 0;
+               if (!_krb425_local_realm &&
+                   krb5_get_default_realm(&_krb425_local_realm))
+                       _krb425_local_realm = NULL;
+
+               if (_krb425_local_realm) {
+                       strncpy(ret_realm, _krb425_local_realm, REALM_SZ);
+                       ret_realm[REALM_SZ-1] = 0;
+               }
        }
 
        if (krb5_get_host_realm(host, &realms)) {