]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Split new symbols between krb5.h and k5-int.h, renaming to krb5int and referrals
authorAndrew Boardman <amb@mit.edu>
Mon, 11 Sep 2006 21:07:55 +0000 (21:07 +0000)
committerAndrew Boardman <amb@mit.edu>
Mon, 11 Sep 2006 21:07:55 +0000 (21:07 +0000)
adding KRB5_CALLCONV as appropriate.

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/referrals@18581 dc483132-0cff-0310-8789-dd5450dbe970

src/include/k5-int.h
src/include/krb5/krb5.hin
src/lib/krb5/krb/gc_frm_kdc.c
src/lib/krb5/krb/gc_via_tkt.c
src/lib/krb5/krb/princ_comp.c
src/lib/krb5/krb/walk_rtree.c
src/lib/krb5/libkrb5.exports
src/lib/krb5/os/hst_realm.c
src/lib/krb5/os/sn2princ.c
src/lib/krb5_32.def

index a55fea7a49eadc420bbd2d9c30642d79f717dd81..46f4e03e33ff9535e0726d6c6cf32a93f0b20748 100644 (file)
@@ -1893,4 +1893,21 @@ extern int krb5int_prng_init(void);
 #define krb5_copy_error_state(CTX, OCTX) \
        krb5int_set_error(&(CTX)->errinfo, (OCTX)->errinfo.code, "%s", (OCTX)->errinfo.msg)
 
+/*
+ * Referral definitions, debugging hooks, and subfunctions.
+ */
+#define        KRB5_REFERRAL_MAXHOPS   5
+/* #define DEBUG_REFERRALS */
+
+#ifdef DEBUG_REFERRALS
+void krb5int_dbgref_dump_principal(char *, krb5_principal);
+#endif
+
+/* Common hostname-parsing code. */
+krb5_error_code KRB5_CALLCONV krb5int_clean_hostname
+       (krb5_context,
+               const char *,
+               char *,
+               size_t);
+
 #endif /* _KRB5_INT_H */
index a04b6306349c038c2016aa7fb37696022183ceeb..418a21c0a48bf0ef8e9ba67c6f028ebae33d68f0 100644 (file)
@@ -263,21 +263,11 @@ typedef const krb5_principal_data *krb5_const_principal;
  * Constants for realm referrals.
  */
 #define        KRB5_REFERRAL_REALM     ""
-#define        KRB5_REFERRAL_MAXHOPS   5
 
 /*
  * Referral-specific functions.
  */
-krb5_boolean krb5_is_referral_realm(krb5_data *);
-
-/*
- * Referral debugging hooks.
- */
-/* #define DEBUG_REFERRALS */
-
-#ifdef DEBUG_REFERRALS
-void dbgref_dump_principal(char *, krb5_principal);
-#endif
+krb5_boolean KRB5_CALLCONV krb5_is_referral_realm(krb5_data *);
 
 /*
  * end "base-defs.h"
@@ -2270,11 +2260,6 @@ krb5_error_code KRB5_CALLCONV krb5_get_fallback_host_realm
        (krb5_context,
                krb5_data *,
                char *** );
-krb5_error_code KRB5_CALLCONV krb5_clean_hostname
-       (krb5_context,
-               const char *,
-               char *,
-               size_t);
 krb5_error_code KRB5_CALLCONV krb5_free_host_realm
        (krb5_context,
                char * const * );
index 036ab32286f89f895b05c899befefc65d5f388c0..44e1b6c3946bab49ff613f6b9e5a49c0b191f661 100644 (file)
@@ -790,8 +790,8 @@ krb5_get_cred_from_kdc_opt(krb5_context context, krb5_ccache ccache,
 
 
 #ifdef DEBUG_REFERRALS
-    dbgref_dump_principal("gc_from_kdc initial client", client);
-    dbgref_dump_principal("gc_from_kdc initial server", server);
+    krb5int_dbgref_dump_principal("gc_from_kdc initial client", client);
+    krb5int_dbgref_dump_principal("gc_from_kdc initial server", server);
 #endif
     memset(&cc_tgt, 0, sizeof(cc_tgt));
     memset(&tgtq, 0, sizeof(tgtq));
@@ -845,7 +845,7 @@ krb5_get_cred_from_kdc_opt(krb5_context context, krb5_ccache ccache,
     }
 
 #ifdef DEBUG_REFERRALS
-    dbgref_dump_principal("gc_from_kdc: server as requested", supplied_server);
+    krb5int_dbgref_dump_principal("gc_from_kdc: server as requested", supplied_server);
 #endif
 
     /*
@@ -857,8 +857,8 @@ krb5_get_cred_from_kdc_opt(krb5_context context, krb5_ccache ccache,
     for (referral_count=0;referral_count<KRB5_REFERRAL_MAXHOPS;referral_count++) {
 #ifdef DEBUG_REFERRALS
 #if 0
-        dbgref_dump_principal("gc_from_kdc: referral loop: tgt in use", tgtptr->server);
-        dbgref_dump_principal("gc_from_kdc: referral loop: request is for", server);
+        krb5int_dbgref_dump_principal("gc_from_kdc: referral loop: tgt in use", tgtptr->server);
+        krb5int_dbgref_dump_principal("gc_from_kdc: referral loop: request is for", server);
 #endif
 #endif
         retval = krb5_get_cred_via_tkt(context, tgtptr,
@@ -901,21 +901,21 @@ krb5_get_cred_from_kdc_opt(krb5_context context, krb5_ccache ccache,
            if (krb5_principal_compare(context, in_cred->server, (*out_cred)->server)) {
 #ifdef DEBUG_REFERRALS
                printf("gc_from_kdc: request generated ticket for requested server principal\n");
-               dbgref_dump_principal("gc_from_kdc final referred reply",in_cred->server);
+               krb5int_dbgref_dump_principal("gc_from_kdc final referred reply",in_cred->server);
 #endif
                goto cleanup;
            }
            else {
 #ifdef DEBUG_REFERRALS
                printf("gc_from_kdc: request generated referral tgt\n");
-               dbgref_dump_principal("gc_from_kdc credential received", (*out_cred)->server);
+               krb5int_dbgref_dump_principal("gc_from_kdc credential received", (*out_cred)->server);
 #endif
                /* Check for referral routing loop. */
                for (i=0;i<referral_count;i++) {
 #ifdef DEBUG_REFERRALS
 #if 0
-                   dbgref_dump_principal("gc_from_kdc: loop compare #1", (*out_cred)->server);
-                   dbgref_dump_principal("gc_from_kdc: loop compare #2", referral_tgts[i]->server);
+                   krb5int_dbgref_dump_principal("gc_from_kdc: loop compare #1", (*out_cred)->server);
+                   krb5int_dbgref_dump_principal("gc_from_kdc: loop compare #2", referral_tgts[i]->server);
 #endif
 #endif
                    if (krb5_principal_compare(context, (*out_cred)->server, referral_tgts[i]->server)) {
@@ -940,8 +940,8 @@ krb5_get_cred_from_kdc_opt(krb5_context context, krb5_ccache ccache,
     }
 
 #ifdef DEBUG_REFERRALS
-    dbgref_dump_principal("gc_from_kdc client at fallback", client);
-    dbgref_dump_principal("gc_from_kdc server at fallback", server);
+    krb5int_dbgref_dump_principal("gc_from_kdc client at fallback", client);
+    krb5int_dbgref_dump_principal("gc_from_kdc server at fallback", server);
 #endif
 
     /*
@@ -979,7 +979,7 @@ krb5_get_cred_from_kdc_opt(krb5_context context, krb5_ccache ccache,
     }
 
 #ifdef DEBUG_REFERRALS
-    dbgref_dump_principal("gc_from_kdc server at fallback after fallback rewrite", server);
+    krb5int_dbgref_dump_principal("gc_from_kdc server at fallback after fallback rewrite", server);
 #endif
 
     /*
@@ -1032,7 +1032,7 @@ cleanup:
     /* Drop the original principal back into in_cred so that it's cached
        in the expected format. */
 #ifdef DEBUG_REFERRALS
-    dbgref_dump_principal("gc_from_kdc: final hacked server principal at cleanup",server);
+    krb5int_dbgref_dump_principal("gc_from_kdc: final hacked server principal at cleanup",server);
 #endif
     krb5_free_principal(context, server);
     in_cred->server = supplied_server;
@@ -1050,7 +1050,7 @@ cleanup:
         krb5_free_principal (context, out_supplied_server);
     }
 #ifdef DEBUG_REFERRALS
-    dbgref_dump_principal("gc_from_kdc: final server after reversion",in_cred->server);
+    krb5int_dbgref_dump_principal("gc_from_kdc: final server after reversion",in_cred->server);
 #endif
     /*
      * Deal with ccache TGT management: If tgts has been set from
@@ -1082,7 +1082,7 @@ cleanup:
                    return subretval;
                (*tgts)[1]=NULL;
 #ifdef DEBUG_REFERRALS
-               dbgref_dump_principal("gc_from_kdc: returning referral TGT for ccache",(*tgts)[0]->server);
+               krb5int_dbgref_dump_principal("gc_from_kdc: returning referral TGT for ccache",(*tgts)[0]->server);
 #endif
 #if 0
            }
@@ -1128,23 +1128,3 @@ krb5_get_cred_from_kdc_renew(krb5_context context, krb5_ccache ccache,
     return krb5_get_cred_from_kdc_opt(context, ccache, in_cred, out_cred, tgts,
                                      KDC_OPT_RENEW);
 }
-
-krb5_boolean krb5_is_referral_realm(krb5_data *r)
-{
-    /*
-     * Check for a match with KRB5_REFERRAL_REALM.  Currently this relies
-     * on that string constant being zero-length.  (Unlike principal realm
-     * names, KRB5_REFERRAL_REALM is known to be a string.)
-     */
-#ifdef DEBUG_REFERRALS
-#if 0
-    printf("krb5_is_ref_realm: checking <%s> for referralness: %s\n",
-          r->data,(r->length==0)?"true":"false");
-#endif
-#endif
-    assert(strlen(KRB5_REFERRAL_REALM)==0);
-    if (r->length==0)
-        return TRUE;
-    else
-        return FALSE;
-}
index c36d29b1dd5e79f68579d41abf938b23b07349c3..d96f84aaa57a81ca75b3773d29d063bddd4165e6 100644 (file)
@@ -109,8 +109,8 @@ krb5_get_cred_via_tkt (krb5_context context, krb5_creds *tkt,
 
 #ifdef DEBUG_REFERRALS
     printf("krb5_get_cred_via_tkt starting; referral flag is %s\n", kdcoptions&KDC_OPT_CANONICALIZE?"on":"off");
-    dbgref_dump_principal("krb5_get_cred_via_tkt requested ticket", in_cred->server);
-    dbgref_dump_principal("krb5_get_cred_via_tkt TGT in use", tkt->server);
+    krb5int_dbgref_dump_principal("krb5_get_cred_via_tkt requested ticket", in_cred->server);
+    krb5int_dbgref_dump_principal("krb5_get_cred_via_tkt TGT in use", tkt->server);
 #endif
 
     /* tkt->client must be equal to in_cred->client */
@@ -238,8 +238,8 @@ krb5_get_cred_via_tkt (krb5_context context, krb5_creds *tkt,
 #if 0
 #ifdef DEBUG_REFERRALS
            printf("gc_via_tkt: in_cred and encoding don't match but referrals requested\n");
-           dbgref_dump_principal("gc_via_tkt: in_cred",in_cred->server);
-           dbgref_dump_principal("gc_via_tkt: encoded server",dec_rep->enc_part2->server);
+           krb5int_dbgref_dump_principal("gc_via_tkt: in_cred",in_cred->server);
+           krb5int_dbgref_dump_principal("gc_via_tkt: encoded server",dec_rep->enc_part2->server);
 #endif
 #endif
        }
index b61f525f40477ab6d56004dd037756d2a4dacfbb..8b52330b34ebbe078c9359be4861d3cc54bb2699 100644 (file)
@@ -65,3 +65,23 @@ krb5_principal_compare(krb5_context context, krb5_const_principal princ1, krb5_c
     }
     return TRUE;
 }
+
+krb5_boolean KRB5_CALLCONV krb5_is_referral_realm(krb5_data *r)
+{
+    /*
+     * Check for a match with KRB5_REFERRAL_REALM.  Currently this relies
+     * on that string constant being zero-length.  (Unlike principal realm
+     * names, KRB5_REFERRAL_REALM is known to be a string.)
+     */
+#ifdef DEBUG_REFERRALS
+#if 0
+    printf("krb5_is_ref_realm: checking <%s> for referralness: %s\n",
+          r->data,(r->length==0)?"true":"false");
+#endif
+#endif
+    assert(strlen(KRB5_REFERRAL_REALM)==0);
+    if (r->length==0)
+        return TRUE;
+    else
+        return FALSE;
+}
index cb76fb235ea4c37b98a6cecf93c4ff942294356e..7210be7c716c33b80fb913b85e6a9617acdee0ef 100644 (file)
@@ -392,7 +392,7 @@ krb5_walk_realm_tree(krb5_context context, const krb5_data *client, const krb5_d
     printf("krb5_walk_realm_tree ending; tree (length %d) is:\n",links);
     for(i=0;i<links+2;i++) {
         if ((*tree)[i])
-           dbgref_dump_principal("krb5_walk_realm_tree tree",(*tree)[i]);
+           krb5int_dbgref_dump_principal("krb5_walk_realm_tree tree",(*tree)[i]);
        else
            printf("tree element %i null\n");
     }
@@ -401,7 +401,7 @@ krb5_walk_realm_tree(krb5_context context, const krb5_data *client, const krb5_d
 }
 
 #ifdef DEBUG_REFERRALS
-void dbgref_dump_principal(char *d, krb5_principal p)
+void krb5int_dbgref_dump_principal(char *d, krb5_principal p)
 {
     int n;
              
index 94e94e45dbb9f9292eeadfe52b71931daebefd24..952ab2f75600b7284a3f9ed8b9df4b6d16d2b239 100644 (file)
@@ -458,6 +458,7 @@ krb5_init_keyblock
 krb5_init_secure_context
 krb5_internalize_opaque
 krb5_is_permitted_enctype
+krb5_is_referral_realm
 krb5_is_thread_safe
 krb5_kdc_rep_decrypt_proc
 krb5_kt_add_entry
index 9d6dfd70d521d455808dbc6a8285311ca0df8338..6646d2da9aebdaa3bab7b9b2fde29f7c4dfc5717 100644 (file)
@@ -204,7 +204,7 @@ krb5_get_host_realm(krb5_context context, const char *host, char ***realmsp)
     printf("get_host_realm(host:%s) called\n",host);
 #endif
 
-    krb5_clean_hostname(context, host, local_host, sizeof local_host);
+    krb5int_clean_hostname(context, host, local_host, sizeof local_host);
 
     /*
        Search for the best match for the host or domain.
@@ -344,7 +344,7 @@ krb5_get_fallback_host_realm(krb5_context context, krb5_data *hdata, char ***rea
     printf("get_fallback_host_realm(host >%s<) called\n",host);
 #endif
 
-    krb5_clean_hostname(context, host, local_host, sizeof local_host);
+    krb5int_clean_hostname(context, host, local_host, sizeof local_host);
 
     /* Scan hostname for DNS realm, and save as last-ditch realm
        assumption. */
@@ -430,7 +430,7 @@ krb5_get_fallback_host_realm(krb5_context context, krb5_data *hdata, char ***rea
  * to do basic sanity checks on supplied hostname.
  */
 krb5_error_code KRB5_CALLCONV
-krb5_clean_hostname(krb5_context context, const char *host, char *local_host, size_t lhsize)
+krb5int_clean_hostname(krb5_context context, const char *host, char *local_host, size_t lhsize)
 {
     char **retrealms;
     char *realm, *cp, *temp_realm;
@@ -439,7 +439,7 @@ krb5_clean_hostname(krb5_context context, const char *host, char *local_host, si
 
     local_host[0]=0;
 #ifdef DEBUG_REFERRALS
-    printf("krb5_clean_hostname called: host<%s>, local_host<%s>, size %d\n",host,local_host,lhsize);
+    printf("krb5int_clean_hostname called: host<%s>, local_host<%s>, size %d\n",host,local_host,lhsize);
 #endif
     if (host) {
        /* Filter out numeric addresses if the caller utterly failed to
@@ -484,7 +484,7 @@ krb5_clean_hostname(krb5_context context, const char *host, char *local_host, si
            local_host[l-1] = 0;
 
 #ifdef DEBUG_REFERRALS
-    printf("krb5_clean_hostname ending: host<%s>, local_host<%s>, size %d\n",host,local_host,lhsize);
+    printf("krb5int_clean_hostname ending: host<%s>, local_host<%s>, size %d\n",host,local_host,lhsize);
 #endif
     return 0;
 }
index fba55972654a4775fee4eb401a28dab87ff77c19..683cc10cb829714fbb829ff00e9d45806c004372 100644 (file)
@@ -201,7 +201,7 @@ krb5_sname_to_principal(krb5_context context, const char *hostname, const char *
        printf("krb5_sname_to_principal returning\n");
        printf("realm: <%s>, sname: <%s>, remote_host: <%s>\n",
               realm,sname,remote_host);
-       dbgref_dump_principal("krb5_sname_to_principal",*ret_princ);
+       krb5int_dbgref_dump_principal("krb5_sname_to_principal",*ret_princ);
 #endif
 
        free(remote_host);
index 9785df56300e730c7a815ffbc4ff5e926e6b4da1..b2a8361c1f4f15eaf1f61c42e789e3de23804f90 100644 (file)
@@ -171,6 +171,7 @@ krb5_c_string_to_key_with_params
        krb5_init_keyblock
        krb5_init_random_key
        krb5_init_secure_context
+       krb5_is_referral_realm
         krb5_is_thread_safe
        krb5_kt_add_entry
        krb5_kt_close