Hi,

I added a user with a '.' in his name just to find that I couldn't use chown
for that user. I have written a patch to escape '.' in the user name.

[manas@manas Cprog] diff -car fileutils-3.16.mod/lib/userspec.c 
fileutils-3.16.orig/lib/userspec.c


*** fileutils-3.16.mod/lib/userspec.c   Fri Feb 11 18:34:17 2000
--- fileutils-3.16.orig/lib/userspec.c  Mon Jul 15 09:05:14 1996
***************
*** 135,168 ****
  
    /* Find the separator if there is one.  */
    separator = strchr (spec, ':');
- 
-   /* '.' needs to be handled differently as there might be a lot of them
-    *  and many of them might be escaped.
-    */
    if (separator == NULL)
!   {
!     char *spec_bck = spec;
!     int doexit=0;
! 
!     while (!doexit)
!     {
!       separator = strchr (spec_bck, '.');
!     
!       /* Find if '.' is escaped by a '\'      */
!       if (separator && separator != spec_bck && *(separator - 1) == '\\')
!       {
!       int len;
! 
!       len = strlen (spec_bck) - (separator - spec_bck);
!       memmove(separator - 1, separator, len);
!       spec_bck[ strlen(spec_bck) - 1 ] = '\0';
!       spec_bck = separator + 1;
!       separator = NULL;
!       }
!       else 
!       doexit = 1;
!     }
!   }
  
    /* Replace separator with a NUL.  */
    if (separator != NULL)
--- 135,142 ----
  
    /* Find the separator if there is one.  */
    separator = strchr (spec, ':');
    if (separator == NULL)
!     separator = strchr (spec, '.');
  
    /* Replace separator with a NUL.  */
    if (separator != NULL)


-------------//\\----------------

Please let me know what you think about this patch.

        --manas

Reply via email to