ClientApi::GetPassword()
Get password setting.
Virtual? |
No |
|
Class |
||
Arguments |
None |
|
Returns |
|
a reference to the password |
Notes
See GetClient()
for
more about the StrPtr
return value.
This method returns the password currently set on the client, which may
or may not be the one set on the server for this user. The command
"p4 passwd
" sets P4PASSWD
on the
client machine to an MD5 hash of the actual password, in which case GetPassword()
returns this MD5 hash rather than the plaintext version.
However, if the user sets P4PASSWD
directly with the
plaintext version, GetPassword()
returns that plaintext version. In both instances, the result is the same
as that displayed by "p4 set
" or an equivalent
command that displays the value of the P4PASSWD
environment variable.
SetPassword()
overrides the P4PASSWD
value, and subsequent GetPassword()
calls
return the new value set by SetPassword()
rather
than the one in the environment.
Example
The following example demonstrates the usage of GetPassword()
.
ClientApi client; printf( "Your password is %s\n", client.GetPassword().Text() );
The following session illustrates the effect of password settings on GetPassword()
:
> p4 set P4PASSWD=p455w04d > a.out Your password is p455w04d > p4 passwd Enter new password: Re-enter new password: Password updated. > a.out Your password is 6F577E10961C8F7B519501097131787C