Skip Menu |

This queue is for tickets about the Authen-Krb5-Admin CPAN distribution.

Report information
The Basics
Id: 83089
Status: resolved
Priority: 0/
Queue: Authen-Krb5-Admin

People
Owner: sjq-perl [...] jadevine.org.uk
Requestors: abubale [...] linkedin.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: get_principals returns single/last entry instead of all matching entries
Date: Fri, 1 Feb 2013 11:42:57 +0000
To: "bug-Authen-Krb5-Admin [...] rt.cpan.org" <bug-Authen-Krb5-Admin [...] rt.cpan.org>
From: Abhishek Amarnath Ubale <abubale [...] linkedin.com>
Hi, Im using Authen::Krb5::Admin to connect to our KDC and list all principals but there seems to be a bug in get_principals function which always returns the a single last matching entry instead of all matching entries. Here is my code snippet: Show quoted text
_________________________________ #!/bin/perl -w use Authen::Krb5; use Authen::Krb5::Admin qw(:constants); my @names; Authen::Krb5::init_context; Authen::Krb5::init_ets; my $kadm5 = Authen::Krb5::Admin->init_with_password($ENV{'krb_admin'}, $ENV{'krb_password'}) || die("Unable to init"); @names = $kadm5->get_principals() || die("Unable to get principals: Authen::Krb5::Admin::error"); print "@names\n";
________________________________ Thanks Abhishek
Thanks for your bug report, it's much appreciated. I have tested the get_principals function and agree with you that there is a bug which means it only returns the last entry. Stephen Quinney On Fri Feb 01 06:43:30 2013, abubale@linkedin.com wrote: Show quoted text
> Hi, > > Im using Authen::Krb5::Admin to connect to our KDC and list all > principals but there seems to be a bug in get_principals function > which always returns the a single last matching entry instead of > all matching entries. Here is my code snippet: > > _________________________________ > #!/bin/perl -w > use Authen::Krb5; > use Authen::Krb5::Admin qw(:constants); > my @names; > > Authen::Krb5::init_context; > Authen::Krb5::init_ets; > > my $kadm5 = Authen::Krb5::Admin->init_with_password($ENV{'krb_admin'}, > $ENV{'krb_password'}) || die("Unable to init"); > @names = $kadm5->get_principals() || die("Unable to get principals: > Authen::Krb5::Admin::error"); > print "@names\n"; > ________________________________ > > Thanks > Abhishek
Subject: Re: [rt.cpan.org #83089] get_principals returns single/last entry instead of all matching entries
Date: Wed, 20 Feb 2013 10:55:34 +0000
To: "bug-Authen-Krb5-Admin [...] rt.cpan.org" <bug-Authen-Krb5-Admin [...] rt.cpan.org>
From: Abhishek Amarnath Ubale <abubale [...] linkedin.com>
I have found that this bug shows itself only when you have a "|| die ()" condition for the get_principals() call not otherwise. Thanks Abhishek On 2/20/13 4:10 PM, "Stephen Quinney via RT" <bug-Authen-Krb5-Admin@rt.cpan.org> wrote: Show quoted text
><URL: https://rt.cpan.org/Ticket/Display.html?id=83089 > > >Thanks for your bug report, it's much appreciated. I have tested the >get_principals function and agree with you that there is a bug which >means it only returns the last entry. > > >Stephen Quinney > >On Fri Feb 01 06:43:30 2013, abubale@linkedin.com wrote:
>> Hi, >> >> Im using Authen::Krb5::Admin to connect to our KDC and list all >> principals but there seems to be a bug in get_principals function >> which always returns the a single last matching entry instead of >> all matching entries. Here is my code snippet: >> >> _________________________________ >> #!/bin/perl -w >> use Authen::Krb5; >> use Authen::Krb5::Admin qw(:constants); >> my @names; >> >> Authen::Krb5::init_context; >> Authen::Krb5::init_ets; >> >> my $kadm5 = Authen::Krb5::Admin->init_with_password($ENV{'krb_admin'}, >> $ENV{'krb_password'}) || die("Unable to init"); >> @names = $kadm5->get_principals() || die("Unable to get principals: >> Authen::Krb5::Admin::error"); >> print "@names\n"; >> ________________________________ >> >> Thanks >> Abhishek
> > >
Yes, I just looked more closely at your test code. This is not a bug but just a side-effect of using the '|| die "..."' condition. Here's a very simple example which demonstrates the same issue: perl -wE 'sub foo { return qw(a b c) } @bar = foo() || die ""; say "@bar"' that just prints 'c' If you replace the '||' with 'or', for example: perl -wE 'sub foo { return qw(a b c) } @bar = foo() or die ""; say "@bar"' you get 'a b c' instead. I think I can close this bug now. Cheers, Stephen Quinney On Wed Feb 20 05:56:17 2013, abubale@linkedin.com wrote: Show quoted text
> I have found that this bug shows itself only when you have a "|| die ()" > condition for the get_principals() call not otherwise. > > Thanks > Abhishek > > On 2/20/13 4:10 PM, "Stephen Quinney via RT" > <bug-Authen-Krb5-Admin@rt.cpan.org> wrote: >
> ><URL: https://rt.cpan.org/Ticket/Display.html?id=83089 > > > > >Thanks for your bug report, it's much appreciated. I have tested the > >get_principals function and agree with you that there is a bug which > >means it only returns the last entry. > > > > > >Stephen Quinney > > > >On Fri Feb 01 06:43:30 2013, abubale@linkedin.com wrote:
> >> Hi, > >> > >> Im using Authen::Krb5::Admin to connect to our KDC and list all > >> principals but there seems to be a bug in get_principals function > >> which always returns the a single last matching entry instead of > >> all matching entries. Here is my code snippet: > >> > >> _________________________________ > >> #!/bin/perl -w > >> use Authen::Krb5; > >> use Authen::Krb5::Admin qw(:constants); > >> my @names; > >> > >> Authen::Krb5::init_context; > >> Authen::Krb5::init_ets; > >> > >> my $kadm5 = Authen::Krb5::Admin->init_with_password($ENV{'krb_admin'}, > >> $ENV{'krb_password'}) || die("Unable to init"); > >> @names = $kadm5->get_principals() || die("Unable to get principals: > >> Authen::Krb5::Admin::error"); > >> print "@names\n"; > >> ________________________________ > >> > >> Thanks > >> Abhishek
> > > > > >
>