]> eyrie.org Git - kerberos/perl-kerberos.git/commitdiff
Rename internal functions to not use the krb5_* namespace
authorRuss Allbery <rra@cpan.org>
Thu, 17 Apr 2014 04:55:34 +0000 (21:55 -0700)
committerRuss Allbery <rra@cpan.org>
Thu, 17 Apr 2014 04:55:34 +0000 (21:55 -0700)
Just in case we might eventually conflict with Kerberos functions,
rename internal functions to use an akrb_* prefix.

lib/Authen/Kerberos.xs
lib/Authen/Kerberos/Kadmin.xs
util/context.c
util/croak.c
util/util.h
util/wrap.c

index dd9eac8c6d7dadfa99ecb11cd5b7641a22717daa..43ee61a78b561be0332be91c3483d0c7c8f1f87e 100644 (file)
@@ -185,7 +185,7 @@ new(class)
 {
     code = krb5_init_context(&ctx);
     if (code != 0)
-        krb5_croak(NULL, code, "krb5_init_context", FALSE);
+        akrb_croak(NULL, code, "krb5_init_context", FALSE);
     RETVAL = ctx;
 }
   OUTPUT:
@@ -247,12 +247,12 @@ authenticate(self, args)
     /* Obtain credentials. */
     code = krb5_get_init_creds_opt_alloc(ctx, &opts);
     if (code != 0)
-        krb5_croak(self, code, "krb5_get_init_creds_opt_alloc", FALSE);
+        akrb_croak(self, code, "krb5_get_init_creds_opt_alloc", FALSE);
     code = krb5_get_init_creds_keytab(self, &creds, princ, kt, 0, service,
                                       opts);
     krb5_get_init_creds_opt_free(ctx, opts);
     if (code != 0)
-        krb5_croak(self, code, "krb5_get_init_creds_keytab", FALSE);
+        akrb_croak(self, code, "krb5_get_init_creds_keytab", FALSE);
 
     /* Allocate the return data structure. */
     RETVAL = malloc(sizeof(*RETVAL));
@@ -281,7 +281,7 @@ keytab(self, name)
     CROAK_NULL_SELF(self, "Authen::Kerberos", "keytab");
     code = krb5_kt_resolve(self, name, &keytab);
     if (code != 0)
-        krb5_croak(self, code, "krb5_kt_resolve", FALSE);
+        akrb_croak(self, code, "krb5_kt_resolve", FALSE);
     kt = malloc(sizeof(*kt));
     if (kt == NULL)
         croak("cannot allocate memory");
@@ -307,7 +307,7 @@ principal(self, name)
     CROAK_NULL_SELF(self, "Authen::Kerberos", "principal");
     code = krb5_parse_name(self, name, &princ);
     if (code != 0)
-        krb5_croak(self, code, "krb5_parse_name", FALSE);
+        akrb_croak(self, code, "krb5_parse_name", FALSE);
     principal = malloc(sizeof(*principal));
     if (principal == NULL)
         croak("cannot allocate memory");
@@ -331,7 +331,7 @@ DESTROY(self)
 {
     if (self == NULL)
         return;
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Creds");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Creds");
     krb5_free_cred_contents(ctx, &self->creds);
     SvREFCNT_dec(self->ctx);
     free(self);
@@ -349,8 +349,8 @@ client(self)
   CODE:
 {
     CROAK_NULL_SELF(self, "Authen::Kerberos::Creds", "client");
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Creds");
-    RETVAL = krb5_wrap_principal(ctx, self->ctx, self->creds.client);
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Creds");
+    RETVAL = akrb_wrap_principal(ctx, self->ctx, self->creds.client);
 }
   OUTPUT:
     RETVAL
@@ -367,8 +367,8 @@ server(self)
   CODE:
 {
     CROAK_NULL_SELF(self, "Authen::Kerberos::Creds", "server");
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Creds");
-    RETVAL = krb5_wrap_principal(ctx, self->ctx, self->creds.server);
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Creds");
+    RETVAL = akrb_wrap_principal(ctx, self->ctx, self->creds.server);
 }
   OUTPUT:
     RETVAL
@@ -385,7 +385,7 @@ DESTROY(self)
 {
     if (self == NULL)
         return;
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Keytab");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Keytab");
     krb5_kt_close(ctx, self->keytab);
     SvREFCNT_dec(self->ctx);
     free(self);
@@ -405,12 +405,12 @@ entries(self)
   PPCODE:
 {
     CROAK_NULL_SELF(self, "Authen::Kerberos::Keytab", "entries");
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Keytab");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Keytab");
 
     /* Start the cursor. */
     code = krb5_kt_start_seq_get(ctx, self->keytab, &cursor);
     if (code != 0)
-        krb5_croak(ctx, code, "krb5_kt_start_seq_get", FALSE);
+        akrb_croak(ctx, code, "krb5_kt_start_seq_get", FALSE);
 
     /* For each entry, either count it or add it to the output stack. */
     code = krb5_kt_next_entry(ctx, self->keytab, &entry, &cursor);
@@ -435,7 +435,7 @@ entries(self)
 
     /* Make sure everything was successful and close the cursor. */
     if (code != KRB5_KT_END)
-        krb5_croak(ctx, code, "krb5_kt_next_entry", FALSE);
+        akrb_croak(ctx, code, "krb5_kt_next_entry", FALSE);
     krb5_kt_end_seq_get(ctx, self->keytab, &cursor);
 
     /* If we're in a scalar context, push the count. */
@@ -458,7 +458,7 @@ DESTROY(self)
 {
     if (self == NULL)
         return;
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::KeytabEntry");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::KeytabEntry");
     krb5_kt_free_entry(ctx, &self->entry);
     SvREFCNT_dec(self->ctx);
     free(self);
@@ -488,10 +488,10 @@ principal(self)
   CODE:
 {
     CROAK_NULL_SELF(self, "Authen::Kerberos::KeytabEntry", "principal");
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::KeytabEntry");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::KeytabEntry");
     code = krb5_copy_principal(ctx, self->entry.principal, &princ);
     if (code != 0)
-        krb5_croak(ctx, code, "krb5_copy_principal", FALSE);
+        akrb_croak(ctx, code, "krb5_copy_principal", FALSE);
     principal = malloc(sizeof(*principal));
     if (principal == NULL)
         croak("cannot allocate memory");
@@ -527,7 +527,7 @@ DESTROY(self)
 {
     if (self == NULL)
         return;
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Principal");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Principal");
     krb5_free_principal(ctx, self->principal);
     SvREFCNT_dec(self->ctx);
     free(self);
@@ -547,10 +547,10 @@ to_string(self, other = NULL, swap = 0)
   CODE:
 {
     CROAK_NULL_SELF(self, "Authen::Kerberos::Principal", "to_string");
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Principal");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Principal");
     code = krb5_unparse_name(ctx, self->principal, &principal);
     if (code != 0)
-        krb5_croak(ctx, code, "krb5_unparse_name", FALSE);
+        akrb_croak(ctx, code, "krb5_unparse_name", FALSE);
     RETVAL = newSVpv(principal, 0);
     krb5_free_unparsed_name(ctx, principal);
 }
index f50d7e4dc6a780118d27a21401df4fd2c96db578..be473833d2fb1ea9518ea324065ffcadb589ed55 100644 (file)
@@ -113,7 +113,7 @@ new(class, args)
 {
     code = krb5_init_context(&ctx);
     if (code != 0)
-        krb5_croak(NULL, code, "krb5_init_context", FALSE);
+        akrb_croak(NULL, code, "krb5_init_context", FALSE);
 
     /* Parse the arguments to the function, if any. */
     memset(&params, 0, sizeof(params));
@@ -128,12 +128,12 @@ new(class, args)
             config_file = SvPV_nolen(*value);
             code = krb5_prepend_config_files_default(config_file, &files);
             if (code != 0)
-                krb5_croak(ctx, code, "krb5_prepend_config_files_default",
+                akrb_croak(ctx, code, "krb5_prepend_config_files_default",
                            TRUE);
             code = krb5_set_config_files(ctx, files);
             krb5_free_config_files(files);
             if (code != 0)
-                krb5_croak(ctx, code, "krb5_set_config_files", TRUE);
+                akrb_croak(ctx, code, "krb5_set_config_files", TRUE);
         }
 
         /* Set configuration parameters used by kadm5_init. */
@@ -164,7 +164,7 @@ new(class, args)
                                         &params,  KADM5_STRUCT_VERSION,
                                         KADM5_API_VERSION_2, &handle);
     if (code != 0)
-        krb5_croak(ctx, code, "kadm5_init_with_password_ctx", TRUE);
+        akrb_croak(ctx, code, "kadm5_init_with_password_ctx", TRUE);
 
     /* Set up password quality checking if desired. */
     if (quality)
@@ -214,10 +214,10 @@ chpass(self, principal, password)
     const char *reason;
   CODE:
 {
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Kadmin");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Kadmin");
     code = krb5_parse_name(ctx, principal, &princ);
     if (code != 0)
-        krb5_croak(ctx, code, "krb5_parse_name", FALSE);
+        akrb_croak(ctx, code, "krb5_parse_name", FALSE);
 
     /*
      * If configured to do quality checking, we need to do that manually,
@@ -230,7 +230,7 @@ chpass(self, principal, password)
         if (reason != NULL) {
             krb5_free_principal(ctx, princ);
             krb5_set_error_message(ctx, KADM5_PASS_Q_DICT, "%s", reason);
-            krb5_croak(ctx, KADM5_PASS_Q_DICT, "kadm5_check_password_quality",
+            akrb_croak(ctx, KADM5_PASS_Q_DICT, "kadm5_check_password_quality",
                        FALSE);
         }
     }
@@ -239,7 +239,7 @@ chpass(self, principal, password)
     code = kadm5_chpass_principal(self->handle, princ, password);
     krb5_free_principal(ctx, princ);
     if (code != 0)
-        krb5_croak(ctx, code, "kadm5_chpass_principal", FALSE);
+        akrb_croak(ctx, code, "kadm5_chpass_principal", FALSE);
     XSRETURN_YES;
 }
 
@@ -257,20 +257,20 @@ get(self, principal)
     Authen__Kerberos__Kadmin__Entry entry;
   CODE:
 {
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Kadmin");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Kadmin");
     ent = calloc(1, sizeof(*ent));
     if (ent == NULL)
         croak("cannot allocate memory");
     code = krb5_parse_name(ctx, principal, &princ);
     if (code != 0)
-        krb5_croak(ctx, code, "krb5_parse_name", FALSE);
+        akrb_croak(ctx, code, "krb5_parse_name", FALSE);
 
     /* By default, get everything except the keys. */
     mask = KADM5_PRINCIPAL_NORMAL_MASK;
     code = kadm5_get_principal(self->handle, princ, ent, mask);
     krb5_free_principal(ctx, princ);
     if (code != 0)
-        krb5_croak(ctx, code, "kadm5_get_principal", FALSE);
+        akrb_croak(ctx, code, "kadm5_get_principal", FALSE);
 
     /* Build our internal representation. */
     entry = calloc(1, sizeof(*entry));
@@ -299,10 +299,10 @@ list(self, pattern)
   PPCODE:
 {
     CROAK_NULL_SELF(self, "Authen::Kerberos::Kadmin", "list");
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Kadmin");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Kadmin");
     code = kadm5_get_principals(self->handle, pattern, &princs, &count);
     if (code != 0)
-        krb5_croak(ctx, code, "kadm5_get_principals", FALSE);
+        akrb_croak(ctx, code, "kadm5_get_principals", FALSE);
     if (GIMME_V == G_ARRAY) {
         EXTEND(SP, count);
         for (i = 0; i < count; i++)
@@ -329,10 +329,10 @@ modify(self, entry)
     CROAK_NULL_SELF(self, "Authen::Kerberos::Kadmin", "modify");
     CROAK_NULL(entry, "Authen::Kerberos::Kadmin::Entry",
                "Authen::Kerberos::Kadmin::modify");
-    ctx = krb5_context_from_sv(self->ctx, "Authen::Kerberos::Kadmin");
+    ctx = akrb_context_from_sv(self->ctx, "Authen::Kerberos::Kadmin");
     code = kadm5_modify_principal(self->handle, entry->ent, entry->mask);
     if (code != 0)
-        krb5_croak(ctx, code, "kadm5_modify_principal", FALSE);
+        akrb_croak(ctx, code, "kadm5_modify_principal", FALSE);
     XSRETURN_YES;
 }
 
index 98e8950ec3a9e4acb7c28910ed4e98b464b8861b..074a172c0263a055188af125fbb3b96211a693f2 100644 (file)
@@ -42,7 +42,7 @@
  * which the context is being retrieved for error reporting.
  */
 krb5_context
-krb5_context_from_sv(SV *ctx_sv, const char *type)
+akrb_context_from_sv(SV *ctx_sv, const char *type)
 {
     IV ctx_iv;
     krb5_context ctx;
index b888e090d49a0a9043a301d906289ec9aa808b92..e0861b8af88d13354f65f8f078bb087e7bdb1ebb 100644 (file)
@@ -43,7 +43,7 @@
  * used in cases where we're croaking inside the constructor.
  */
 void
-krb5_croak(krb5_context ctx, krb5_error_code code, const char *function,
+akrb_croak(krb5_context ctx, krb5_error_code code, const char *function,
            bool destroy)
 {
     HV *hv;
index c0209ea5aa09a6d7d46f53c0b8f954f2a629bd35..66d718ff8686047b17a75c797f90f7e7eba607bb 100644 (file)
@@ -69,7 +69,7 @@ BEGIN_DECLS
  * context.  Takes the type of the object making this call for error
  * reporting.  Croaks if the SV is not valid.
  */
-krb5_context krb5_context_from_sv(SV *, const char *type);
+krb5_context akrb_context_from_sv(SV *, const char *type);
 
 /*
  * Given a Kerberos context, an error code, and the Kerberos function that
@@ -77,7 +77,7 @@ krb5_context krb5_context_from_sv(SV *, const char *type);
  * croak.  The final boolean argument says whether to free the context before
  * calling croak.
  */
-void krb5_croak(krb5_context, krb5_error_code, const char *function,
+void akrb_croak(krb5_context, krb5_error_code, const char *function,
                 bool destroy)
     __attribute__((__noreturn__));
 
@@ -86,7 +86,7 @@ void krb5_croak(krb5_context, krb5_error_code, const char *function,
  * copy the latter and create a wrapped Authen__Kerberos__Principal object
  * suitable for returning to let XS bless into an Authen::Kerberos::Principal.
  */
-Authen__Kerberos__Principal krb5_wrap_principal(krb5_context, SV *,
+Authen__Kerberos__Principal akrb_wrap_principal(krb5_context, SV *,
                                                 krb5_principal);
 
 /* Undo default visibility change. */
index 15e1dd6eca2af170eb0df33f2dffc914b355692d..044528325d846fec8fb6cf8fe7e2b0ce97ffe3c1 100644 (file)
@@ -44,7 +44,7 @@
  * latter in the created struct.
  */
 Authen__Kerberos__Principal
-krb5_wrap_principal(krb5_context ctx, SV *krb5, krb5_principal princ)
+akrb_wrap_principal(krb5_context ctx, SV *krb5, krb5_principal princ)
 {
     krb5_principal copy;
     krb5_error_code code;
@@ -52,7 +52,7 @@ krb5_wrap_principal(krb5_context ctx, SV *krb5, krb5_principal princ)
 
     code = krb5_copy_principal(ctx, princ, &copy);
     if (code != 0)
-        krb5_croak(ctx, code, "krb5_copy_principal", FALSE);
+        akrb_croak(ctx, code, "krb5_copy_principal", FALSE);
     principal = malloc(sizeof(*principal));
     if (principal == NULL)
         croak("cannot allocate memory");