[Samba] $ char in password

Xu, Qiang (FXSGSC) Qiang.Xu at fujixerox.com
Tue Mar 11 06:24:47 GMT 2008


Hi, all:

Just come across a strange problem with the usage of "net rpc ...".

If a user's password has the dollar character, it will be discarded, thus cause login failure. For example, if username is "abc" and password is "$1111". I run the command:
=======================================================
net rpc -I 12.34.56.78 -U abc%$1111 USER INFO abc
=======================================================
to determine the user's group.

What I get is:
=======================================================
Could not connect to server 12.34.56.78
The username or password was not correct.
Connection failed: NT_STATUS_LOGON_FAILURE
=======================================================

I add some printf in net.c:
=======================================================
 int main(int argc, const char **argv)
{
  ......
        while((opt = poptGetNextOpt(pc)) != -1) {
                switch (opt) {
                        ......
                case 'U':
                        opt_user_specified = True;
                        d_fprintf(stderr, "%s(): opt_user_name is %s\n", __FUNCTION__, opt_user_name); //xq
                        opt_user_name = SMB_STRDUP(opt_user_name);
                        p = strchr(opt_user_name,'%');
                        if (p) {
                                *p = 0;
                                opt_password = p+1;
                                d_fprintf(stderr, "%s(): opt_password is %s\n", __FUNCTION__, opt_password); //xq
                        }
                        break;
                        ......
                }
        }
  ......
}
=======================================================

To my surprise, the output is:
=======================================================
main(): opt_user_name is abc%111
main(): opt_password is 111
Could not connect to server 13.121.8.185
The username or password was not correct.
Connection failed: NT_STATUS_LOGON_FAILURE
=======================================================
This means the "net" binary cannot correctly read in all characters in the password field if there is a $ in it, right? Any fix to this problem? (I am using samba-3.0.25a to compile the "net" binary)

TIA,
Xu Qiang



More information about the samba mailing list