]> eyrie.org Git - kerberos/heimdal-kadm5.git/commitdiff
Password support from lha@it.su.se
authorleifj <leifj@453aeaa5-fa1e-0410-b91d-a05dbf4e1782>
Mon, 5 Sep 2005 06:58:16 +0000 (06:58 +0000)
committerleifj <leifj@453aeaa5-fa1e-0410-b91d-a05dbf4e1782>
Mon, 5 Sep 2005 06:58:16 +0000 (06:58 +0000)
git-svn-id: svn://svn.it.su.se/Heimdal-Kadm5/trunk@18 453aeaa5-fa1e-0410-b91d-a05dbf4e1782

Kadm5.pm
Kadm5.xs

index f08df017b749296064f5b1b17122ce3cdde6c975..b95ecc1a363ee338012280f6daa298c3b76e6ce5 100644 (file)
--- a/Kadm5.pm
+++ b/Kadm5.pm
@@ -124,7 +124,7 @@ require AutoLoader;
                USE_KADM5_API_VERSION
               );
 
-$VERSION = '0.04';
+$VERSION = '0.05';
 
 sub AUTOLOAD {
     # This AUTOLOAD is used to 'autoload' constants from the constant()
@@ -245,7 +245,7 @@ sub getPrincipal
     my $princ = shift;
     my $mask = shift;
 
-    $mask = (Heimdal::Kadm5::KADM5_PRINCIPAL_NORMAL_MASK()|Heimdal::Kadm5::KADM5_KEY_DATA()) unless $mask;
+    $mask = (Heimdal::Kadm5::KADM5_PRINCIPAL_NORMAL_MASK()|Heimdal::Kadm5::KADM5_KEY_DATA()|Heimdal::Kadm5::KADM5_TL_DATA()) unless $mask;
     $self->handle->c_get_principal($princ,$mask);
   }
 
@@ -738,6 +738,12 @@ salt are strings which describe a key associated with the principal.
 Note that this data may not be present depending on how the principal
 was obtained.
 
+my $password = $principal->getPassword();
+
+getPassword returns the password if its saved in the Kerberos database.
+Not the that principal object need to fetched with the bit KADM5_TL_DATA
+set in the mask.
+
 
 =head1 Exported constants
 
index c617e9d99dce81bfbfcef3ead65fbc4d9a040e96..23bebe6321755b18ca5ef32e09b28b3b9f7cd4b3 100644 (file)
--- a/Kadm5.xs
+++ b/Kadm5.xs
@@ -890,6 +890,31 @@ getKeytypes(spp)
      OUTPUT:
      RETVAL
 
+SV *
+getPassword(spp)
+     sprincipal_t *spp
+     CODE:
+     {
+#ifdef KRB5_TL_PASSWORD
+       krb5_tl_data *tl = spp->principal.tl_data;
+
+       while (tl != NULL)
+         {
+          if (tl->tl_data_type == KRB5_TL_PASSWORD)
+            break;
+          tl = tl->tl_data_next;
+         }
+
+       if (tl)
+        RETVAL = newSVpv(tl->tl_data_contents,0);
+       else
+#endif
+        RETVAL = &PL_sv_undef;
+     }
+     OUTPUT:
+     RETVAL
+
+
 MODULE = Heimdal::Kadm5                    PACKAGE = Heimdal::Kadm5
 
 double