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>
Tue, 13 Apr 2010 06:57:27 +0000 (08:57 +0200)
source3/smbd/map_username.c

index 53e836935343055f16ed0f767104dda8d0f119e7..0165bef40268b2cec386342720048fbeae3ba1b5 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(fstring user)
 {
        XFILE *f;
@@ -157,14 +165,11 @@ bool map_username(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))