This is the mail archive of the cygwin@cygwin.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]
Other format: [Raw text]

RE: Suggestion for setup


> -----Original Message-----
> From: Bernard Dautrevaux [mailto:Dautrevaux@microprocess.com]
> Sent: Wednesday, March 06, 2002 2:32 PM
> To: 'Corinna Vinschen'
> Cc: cygwin@cygwin.com
> Subject: RE: Suggestion for setup
> 
> 
> > -----Original Message-----
> > From: Corinna Vinschen [mailto:cygwin@cygwin.com]
> > Sent: Wednesday, March 06, 2002 10:19 AM
> > To: cygwin@cygwin.com
> > Subject: Re: Suggestion for setup
> > 
> > 
> > On Wed, Mar 06, 2002 at 10:01:22AM +0100, Bernard Dautrevaux wrote:
> > > On the same ground, it would be nice if, when creating 
> > /etc/passwd and
> > > /etc/group, setup.exe pass the "-d" flag to 
> > mkpasswd/mkgroup; otherwise,
> > > ntsec is almost unusable for the (vast majority of) 
> > NT/2k/XP users that
> > > happen to be in a Windows domain.
> > > 
> > > I don't know what happens if "mkpasswd -d" is used on 9x/Me 
> > if not in a
> > > domain, but this seems harmless on NT/2k/XP, so always 
> > passing -d seems
> > > harmless in these cases.
> > 
> > It's not harmless.  mkpasswd -d will result in an error message on
> > stand alone systems.  
> 
> Oh yes, I forgot that... By saying "harmless" I just wanted 
> to say that it
> doesn't break anything, so you can ignore the error message 
> altogether,
> something I actually do :-)
> 
> > It's actually the other way around.  mkpasswd -l
> > is harmless on domain members and domain controllers.
> 
> Yes but it doesn't give th eexpected result... What if we add a "-a"
> argument (saying generate all possible entries, either local 
> or from the
> domain), that in fact will just avoid th eerror message and 
> return code that
> "-d" generates if it can't found a domain controller? 
> 
> Would a patch on these lines be acceptable, as a first step to allow
> automatic generation of complete /etc/passwd and /etc/group 
> files during
> cygwin install?

As this is quite a simple patch, I proceed and here it is, for mkgroup.c and
mkpasswd.c:

*** winsup/utils/mkgroup.c 2001/04/26 19:02:52 1.3
--- winsup/utils/mkgroup.c 2002/03/06 14:10:18
***************
*** 367,370 ****
--- 367,373 ----
    fprintf (stderr, "                          specified (or from the
current domain if there is\n");
    fprintf (stderr, "                          no domain specified)\n");
+   fprintf (stderr, "   -a,--all               print both local and global
group information from the\n");
+   fprintf (stderr, "                          specified domain (or from
the current domain if there is\n");
+   fprintf (stderr, "                          no domain specified) but do
not complain if not in a domain\n");
    fprintf (stderr, "   -o,--id-offset offset  change the default offset
(10000) added to uids\n");
    fprintf (stderr, "                          in domain accounts.\n");
***************
*** 416,419 ****
--- 419,424 ----
            switch (i)
       {
+      case 'a':
+        print_domain = -1;
       case 'l':
         print_local = 1;
***************
*** 439,443 ****
          if (!print_local && !print_domain)
            {
!      fprintf (stderr, "%s: Specify one of `-l' or `-d'\n", argv[0]);
       return 1;
     }
--- 444,448 ----
          if (!print_local && !print_domain)
            {
!      fprintf (stderr, "%s: Specify one of `-l', `-d' or `-a'\n", argv[0]);
       return 1;
     }
***************
*** 447,451 ****
         {
           fprintf (stderr, "%s: A domain name is only accepted "
!                   "when `-d' is given.\n", argv[0]);
           return 1;
         }
--- 452,456 ----
         {
           fprintf (stderr, "%s: A domain name is only accepted "
!                   "when `-d' or `-a' is given.\n", argv[0]);
           return 1;
         }
***************
*** 545,553 ****
        if (rc != ERROR_SUCCESS)
   {
!    fprintf (stderr, "Cannot get PDC, code = %ld\n", rc);
!    exit (1);
   }
! 
!       enum_groups (servername, print_sids, print_users, id_offset);
      }
  
--- 550,561 ----
        if (rc != ERROR_SUCCESS)
   {
!    if (print_domain > 0) 
!      {
!        fprintf (stderr, "Cannot get DC, code = %ld\n", rc);
!        exit (1);
!      }
   }
!       else
!  enum_groups (servername, print_sids, print_users, id_offset);
      }
  
*** winsup/utils/mkpasswd.c 2001/04/26 19:02:52 1.4
--- winsup/utils/mkpasswd.c 2002/03/06 14:10:19
***************
*** 321,324 ****
--- 321,326 ----
    fprintf (stderr, "   -d,--domain             print domain accounts (from
current domain\n");
    fprintf (stderr, "                           if no domain
specified)\n");
+   fprintf (stderr, "   -a,--all                print local and domain
accounts (from current domain\n");
+   fprintf (stderr, "                           if no domain specified)
without complaining if not in domain\n");
    fprintf (stderr, "   -o,--id-offset offset   change the default offset
(10000) added to uids\n");
    fprintf (stderr, "                           in domain accounts.\n");
***************
*** 379,382 ****
--- 381,386 ----
     switch (i)
       {
+      case 'a':
+        print_domain = -1;
       case 'l':
         print_local = 1;
***************
*** 416,420 ****
   if (!print_local && !print_domain && !print_local_groups)
     {
!      fprintf (stderr, "%s: Specify one of `-l', `-d' or `-g'\n", argv[0]);
       return 1;
     }
--- 420,424 ----
   if (!print_local && !print_domain && !print_local_groups)
     {
!      fprintf (stderr, "%s: Specify one of `-l', `-d', `-a' or `-g'\n",
argv[0]);
       return 1;
     }
***************
*** 424,428 ****
         {
    fprintf (stderr, "%s: A domain name is only accepted "
!      "when `-d' is given.\n", argv[0]);
    return 1;
         }
--- 428,432 ----
         {
    fprintf (stderr, "%s: A domain name is only accepted "
!      "when `-d' or `-a' is given.\n", argv[0]);
    return 1;
         }
***************
*** 528,536 ****
        if (rc != ERROR_SUCCESS)
   {
!    fprintf (stderr, "Cannot get DC, code = %ld\n", rc);
!    exit (1);
   }
! 
!       enum_users (servername, print_sids, print_cygpath, passed_home_path,
id_offset);
      }
  
--- 532,543 ----
        if (rc != ERROR_SUCCESS)
   {
!    if (print_domain > 0) 
!      {
!        fprintf (stderr, "Cannot get DC, code = %ld\n", rc);
!        exit (1);
!      }
   }
!       else
!  enum_users (servername, print_sids, print_cygpath, passed_home_path,
id_offset);
      }
  
The patch is simple enough I should not need to file a copyright assignment,
isn't-it?

	Bernard

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux@microprocess.com
		b.dautrevaux@usa.net
-------------------------------------------- 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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