s3: Little refactoring: Factor out skip_space
authorVolker Lendecke <vl@samba.org>
Fri, 9 Apr 2010 12:30:54 +0000 (14:30 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 12 Apr 2010 11:18:18 +0000 (13:18 +0200)
source3/smbd/map_username.c

index 8cbe40defd4fb3156fd1781965aa9c83137a76f2..8c8eb2ed9d0e3544300c62f78d1bb2eb0ec0c6ec 100644 (file)
@@ -68,6 +68,14 @@ static bool set_last_from_to(const char *from, const char *to)
        return true;
 }
 
+static char *skip_space(char *s)
+{
+       while (isspace((int)(*s))) {
+               s += 1;
+       }
+       return s;
+}
+
 bool map_username(struct smbd_server_connection *sconn, fstring user)
 {
        XFILE *f;
@@ -157,14 +165,11 @@ bool map_username(struct smbd_server_connection *sconn, fstring user)
 
                *dosname++ = 0;
 
-               while (isspace((int)*unixname))
-                       unixname++;
+               unixname = skip_space(unixname);
 
                if ('!' == *unixname) {
                        return_if_mapped = True;
-                       unixname++;
-                       while (isspace((int)*unixname))
-                               unixname++;
+                       unixname = skip_space(unixname+1);
                }
 
                if (!*unixname || strchr_m("#;",*unixname))