This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch] default homedir (was: Re: Problem with ssh-keygen.exe.


What was the change that impacts 9x/Me?  Chunk 8 looks like a difference
in a printf() statement.  I will be glad the try the change on my W98
box, but I think I'll wait for you to post the updated patch that
Corrina requested (or, at least until tonight, when I can try the change
at home).

--wpd



Chris Abbey wrote:
> 
> I made a change that impacts 9x/Me which I can't test, can someone
> confirm that please? It's not a major functional change, just an
> implementation detail (chunk eight). It also looks like the diff
> tool undid my formatting adjustment in the usage text when I used
> the -b switch, unfortunately without that the crazy mixed indenting
> drove it nuts and it looked like I had changed about 1/3 of the file.
> I can try to provide a separate patch for that if you want.
> 
> Tue Dec  5 23:32:06 2000  Chris Abbey <cabbey@bresnanlink.net>
> 
>          * mkpasswd.c: make default home directory /home/$user if one
>              can't be found in user registry. Allow user to override
>              that with command line arg.
> 
> ~/cygwin/src/winsup/utils $ cvs diff -ub mkpasswd.c
> Index: mkpasswd.c
> ===================================================================
> RCS file: /cvs/src/src/winsup/utils/mkpasswd.c,v
> retrieving revision 1.5
> diff -u -b -r1.5 mkpasswd.c
> --- mkpasswd.c  2000/11/08 15:00:02     1.5
> +++ mkpasswd.c  2000/12/06 05:32:22
> @@ -102,7 +102,7 @@
>   }
> 
>   int
> -enum_users (LPWSTR servername, int print_sids, int print_cygpath)
> +enum_users (LPWSTR servername, int print_sids, int print_cygpath, const
> char * passed_home_path)
>   {
>     USER_INFO_3 *buffer;
>     DWORD entriesread = 0;
> @@ -160,6 +160,11 @@
>             else
>              psx_dir (homedir_w32, homedir_psx);
> 
> +          if (0 == strlen(homedir_psx)) {
> +            strcat(homedir_psx, passed_home_path);
> +            strcat(homedir_psx, username);
> +          }
> +
>             if (print_sids)
>               {
>                 if (!LookupAccountName (servername ? ansi_srvname : NULL,
> @@ -317,6 +322,8 @@
>     fprintf (stderr, "   -m,--no-mount        don't use mount points for
> home dir\n");
>     fprintf (stderr, "   -s,--no-sids         don't print SIDs in GCOS
> field\n");
>     fprintf (stderr, "                        (this affects ntsec)\n");
> +  fprintf (stderr, "   -p,--path-to-home path  if user account has no home
> dir, use\n");
> +  fprintf (stderr, "                           path instead of /home/\n");
>     fprintf (stderr, "   -?,--help            displays this message\n\n");
>     fprintf (stderr, "One of `-l', `-d' or `-g' must be given on NT/W2K.\n");
>     return 1;
> @@ -328,11 +335,12 @@
>     {"loca-groups", no_argument, NULL, 'g'},
>     {"no-mount", no_argument, NULL, 'm'},
>     {"no-sids", no_argument, NULL, 's'},
> +  {"path-to-home",required_argument, NULL, 'p'},
>     {"help", no_argument, NULL, 'h'},
>     {0, no_argument, NULL, 0}
>   };
> 
> -char opts[] = "ldgsmh";
> +char opts[] = "ldgsmhp:";
> 
>   int
>   main (int argc, char **argv)
> @@ -348,7 +356,7 @@
>     int print_cygpath = 1;
>     int i;
> 
> -  char name[256], dom[256];
> +  char name[256], dom[256], passed_home_path[MAX_PATH];
>     DWORD len, len2;
>     PSID sid;
>     SID_NAME_USE use;
> @@ -376,6 +384,17 @@
>              case 'm':
>                print_cygpath = 0;
>                break;
> +        case 'p':
> +          if (optarg[0] != '/') {
> +            fprintf(stderr, "%s: `%s' is not a fully qulaified path.\n",
> +                        argv[0], optarg);
> +            return 1;
> +          }
> +          strcpy(passed_home_path, optarg);
> +          if (optarg[strlen(optarg)-1] != '/') {
> +            strcat(passed_home_path, "/");
> +          }
> +          break;
>              case 'h':
>                return usage ();
>              default:
> @@ -400,6 +419,10 @@
>            }
>         }
> 
> +  if (0 == strlen(passed_home_path)) {
> +      strcpy(passed_home_path, "/home/");
> +  }
> +
>     /* This takes Windows 9x/ME into account. */
>     if (GetVersion () >= 0x80000000)
>       {
> @@ -407,10 +430,10 @@
>         if (!GetUserName (name, (len = 256, &len)))
>           strcpy (name, "unknown");
> 
> -      printf ("%s::%ld:%ld::/home/%s:/bin/sh\n", name,
> +      printf ("%s::%ld:%ld::%s%s:/bin/sh\n", name,
>                                                    DOMAIN_USER_RID_ADMIN,
>                                                    DOMAIN_ALIAS_RID_ADMINS,
> -                                                name);
> +                         passed_home_path, name);
> 
>         return 0;
>       }
> @@ -496,11 +519,11 @@
>            exit (1);
>          }
> 
> -      enum_users (servername, print_sids, print_cygpath);
> +      enum_users (servername, print_sids, print_cygpath, passed_home_path);
>       }
> 
>     if (print_local)
> -    enum_users (NULL, print_sids, print_cygpath);
> +    enum_users (NULL, print_sids, print_cygpath, passed_home_path);
> 
>     if (servername)
>       netapibufferfree (servername);
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]