>> I get a "password invalid" error when
running
>> $p4->RunLogin($user_to_impersonate) even if a
superuser has been
>> specified with SetUser, so no ticket gets
generated.
>
> Have you got a valid ticket for the super-user? You
have to prove you are the
> super-user before you can run 'p4 login
<otheruser>'. Can you run other
> commands as that super-user?
Sorry for the silence, but I have been sidetracked. To reply
to your
question, yes I believe I had a valid ticket for superuser
and could
execute commands as that superuser. However, I am failing to
display
the ticket expiry time. So I seem to have 2 issues with
P4PERL/LINUX26I386/2007.3/151416 (2007.3 API) (2008/04/09).
1- I can't seem to output a users ticket expiry time:
$p4->RunLogin("-s") is mute, so I have to
resort to other means to
determine if the current user (for instance the superuser)
has a valid
ticket. In the example below, I run "p4 depots" as
the superuser is
the only one with access to one of the depots.
2- RunLogin($user) doesn't seem to honor even though the
current user
is superuser. I get Password Invalid.
Unless I am doing something wrong of course, so here's the
script I
used as a test (p4adm is superuser):
In the mean time, I solved my problem by not using the API.
Guillaume
#!/usr/local/bin/perl -w
use strict;
use P4;
our $p4 = new P4;
my users = ('testo', 'testp');
$p4->SetUser("p4adm");
$p4->Connect() or die ("Couldn't initialise p4
connection.nn",
$p4->Errors, "n");
my $inforef = $p4->RunInfo();
print "user is ",
$inforef->[0]->{'userName'}, "n"; # does
say that
user is p4adm
print P4::Identify(), "n";
my $depotsref = $p4->RunDepots(); # works so running
ticket is valid
foreach my $depot ( $depotsref) {
print "p4adm seeing depot : ",
$depot->{'name'}, "n";
}
foreach my $user ( users) {
$p4->RunLogin($user);
print $p4->Errors(), "n" if
$p4->ErrorCount(); # prints
Password Invalid everytime
}
$p4->Disconnect();
foreach my $user ( users) {
$p4 = new P4;
$p4->SetUser($user);
$p4->Connect();
$inforef = $p4->RunInfo();
print "now user is ",
$inforef->[0]->{'userName'}, "n";
$depotsref = $p4->RunDepots(); # Only works if
user has a
valid running ticket before script is invoked
foreach my $depot ( $depotsref) {
print "user ", $user, "
seeing depot : ",
$depot->{'name'}, "n";
}
$p4->Disconnect();
}
exit 0;
_______________________________________________
p4perl mailing list
p4perl perforce.com
http://maillist.perforce.com/mailman/listinfo/p4perl
|