s3-auth: fixed bug with usernames longer than sizeof(char *)
authorAndrew Tridgell <tridge@samba.org>
Fri, 6 May 2011 04:00:27 +0000 (14:00 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 6 May 2011 04:49:47 +0000 (14:49 +1000)
using sizeof(user) when user is "fstring user" as a C parameter
actually returns sizeof(char *), which means that long usernames
aren't allowed.

Jeremy, you need a longer username :-)

Cheers, Tridge

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source3/smbd/password.c

index 34384342afb7e4e4bdc3f03965bf6fc7f3484f3d..69b37596c5db737a9b0bab5b78940e329df98ee6 100644 (file)
@@ -644,7 +644,7 @@ bool authorise_login(struct smbd_server_connection *sconn,
                                        get_session_workgroup(sconn),
                                        user2,password)) {
                                ok = True;
-                               strlcpy(user,user2,sizeof(user));
+                               strlcpy(user,user2,sizeof(fstring));
                                DEBUG(3,("authorise_login: ACCEPTED: session "
                                         "list username (%s) and given "
                                         "password ok\n", user));
@@ -695,7 +695,7 @@ bool authorise_login(struct smbd_server_connection *sconn,
                                                get_session_workgroup(sconn),
                                                user2,password)) {
                                        ok = True;
-                                       strlcpy(user,user2,sizeof(user));
+                                       strlcpy(user,user2,sizeof(fstring));
                                        DEBUG(3,("authorise_login: ACCEPTED: "
                                                 "user list username and "
                                                 "given password ok (%s)\n",
@@ -714,7 +714,7 @@ bool authorise_login(struct smbd_server_connection *sconn,
                fstrcpy(guestname,lp_guestaccount());
                guest_pw = Get_Pwnam_alloc(talloc_tos(), guestname);
                if (guest_pw != NULL) {
-                       strlcpy(user,guestname,sizeof(user));
+                       strlcpy(user,guestname,sizeof(fstring));
                        ok = True;
                        DEBUG(3,("authorise_login: ACCEPTED: guest account "
                                 "and guest ok (%s)\n", user));