Re: [Setup-tool-hackers] Patches



> Attached there's a patch to make shares-conf work again.
> I've also patched samba-conf and util.pl to make it parse correctly
> smb.conf files (it was missing [homes] directive that do not have path
> declared and missed directives with uppercase letters in boolean options
> (eg: Yes True ON) that are valid in smb.conf)

The shares-conf you find in CVS will be replaced by a new, completely
rewritten one, one of these days. So I'm afraid you patch will only serve to
make the old shares-conf work during this period.

Homes is not a "share" as such, we need a set of special-case options for
that. See below for more comments.


> Index: shares-conf.in
> ===================================================================
> RCS file: /cvs/gnome/ximian-setup-tools/backends/shares-conf.in,v
> retrieving revision 1.43
> diff -u -r1.43 shares-conf.in
> --- shares-conf.in	2001/02/22 11:45:29	1.43
> +++ shares-conf.in	2001/03/28 15:23:14
> @@ -574,7 +574,7 @@
>        # New section. If last section was a share, store it in global
>        # records, then flush locals for next instance.
>  
> -      if (($path ne "") && !$printable)
> +      if ((($path ne "") || ($section eq "homes")) && !$printable)
>        {
>          push @cf_exports_list, "smb";        # Type
>          push @cf_exports_list, $path;        # Path
> @@ -1403,11 +1403,11 @@
>    print "<shares>\n";
>    &xst_xml_enter ();
>  
> -  &xst_xml_vspace ();
> -  &xst_xml_print ("<!-- Configuration starts here -->\n");
> -  &xst_xml_vspace ();
> -  &xst_xml_print ("<!-- Imports, listed and potentials -->\n");
> -  &xst_xml_vspace ();
> +  &xst_xml_print_vspace ();
> +  &xst_xml_print_line ("<!-- Configuration starts here -->\n");
> +  &xst_xml_print_vspace ();
> +  &xst_xml_print_line ("<!-- Imports, listed and potentials -->\n");
> +  &xst_xml_print_vspace ();
>  
>    my @shares = @cf_shares_list;
>  
> @@ -1415,8 +1415,8 @@
>    {
>      if ($shares[0] ne "")
>      {
> -      &xst_xml_vspace ();
> -      &xst_xml_print ("<import type='$shares[5]'>\n");
> +      &xst_xml_print_vspace ();
> +      &xst_xml_print_line ("<import type='$shares[5]'>\n");
>        &xst_xml_enter ();
>  
>        $shares[0] = &xst_xml_quote($shares[0]);
> @@ -1425,14 +1425,14 @@
>        $shares[6] = &xst_xml_quote($shares[6]);
>        $shares[7] = &xst_xml_quote($shares[7]);
>  
> -      &xst_xml_print ("<host>$shares[0]</host>\n");
> -      &xst_xml_print ("<path>$shares[1]</path>\n");
> -      if ($shares[6] ne "") { &xst_xml_print ("<user>$shares[6]</user>\n"); }
> -      if ($shares[7] ne "") { &xst_xml_print ("<password>$shares[7]</password>\n"); }
> -      if ($shares[2] ne "") { &xst_xml_print ("<comment>$shares[2]</comment>\n"); }
> -      if ($shares[8] ne "") { &xst_xml_print ("<point>$shares[8]</point>\n"); }
> +      &xst_xml_print_line ("<host>$shares[0]</host>\n");
> +      &xst_xml_print_line ("<path>$shares[1]</path>\n");
> +      if ($shares[6] ne "") { &xst_xml_print_line ("<user>$shares[6]</user>\n"); }
> +      if ($shares[7] ne "") { &xst_xml_print_line ("<password>$shares[7]</password>\n"); }
> +      if ($shares[2] ne "") { &xst_xml_print_line ("<comment>$shares[2]</comment>\n"); }
> +      if ($shares[8] ne "") { &xst_xml_print_line ("<point>$shares[8]</point>\n"); }
>  
> -      &xst_xml_indent ();
> +      &xst_xml_format_indent ();

I think you mean &xst_xml_print_indent (); here.


>  
>        print "<mounted state='";
>        print &xst_print_boolean_truefalse($shares[3]);
> @@ -1447,7 +1447,7 @@
>        print "'/>\n";
>  
>        &xst_xml_leave ();
> -      &xst_xml_print ("</import>\n");
> +      &xst_xml_print_line ("</import>\n");
>      }
>      
>      shift @shares; shift @shares; shift @shares; shift @shares; shift @shares;
> @@ -1455,9 +1455,9 @@
>      shift @shares;
>    }
>  
> -  &xst_xml_vspace ();
> -  &xst_xml_print ("<!-- Exports -->\n");
> -  &xst_xml_vspace ();
> +  &xst_xml_print_vspace ();
> +  &xst_xml_print_line ("<!-- Exports -->\n");
> +  &xst_xml_print_vspace ();
>    
>    my @shares = @cf_exports_list;
>    
> @@ -1465,22 +1465,22 @@
>    {
>      if ($shares[0] ne "")
>      {
> -      &xst_xml_vspace ();
> -      &xst_xml_print ("<export type='$shares[0]'>\n");
> +      &xst_xml_print_vspace ();
> +      &xst_xml_print_line ("<export type='$shares[0]'>\n");
>        &xst_xml_enter ();
>  
> -      &xst_xml_print ("<path>$shares[1]</path>\n");
> +      &xst_xml_print_line ("<path>$shares[1]</path>\n");
>  
>        if ($shares[0] eq "smb")
>        {
> -        &xst_xml_print ("<name>$shares[2]</name>\n");
> -        if ($shares[3] ne "") { &xst_xml_print ("<comment>$shares[3]</comment>\n"); }
> +        &xst_xml_print_line ("<name>$shares[2]</name>\n");
> +        if ($shares[3] ne "") { &xst_xml_print_line ("<comment>$shares[3]</comment>\n"); }
>  
> -        &xst_xml_indent ();
> +        &xst_xml_format_indent ();

&xst_xml_print_indent ();


>          print "<enabled state='", &xst_print_boolean_truefalse($shares[4]), "'/>";
>          print "<browse state='", &xst_print_boolean_truefalse($shares[5]), "'/>";
>          print "<public state='", &xst_print_boolean_truefalse($shares[6]), "'/>\n";
> -        &xst_xml_indent ();
> +        &xst_xml_format_indent ();

&xst_xml_print_indent ();


>          print "<write state='", &xst_print_boolean_truefalse($shares[7]), "'/>\n";
>  
>          shift @shares; shift @shares; shift @shares; shift @shares;
> @@ -1493,7 +1493,7 @@
>          {
>            if ($$clients[0] ne "")
>            {
> -            &xst_xml_print ("<allow><pattern>$$clients[0]</pattern><write state='");
> +            &xst_xml_print_line ("<allow><pattern>$$clients[0]</pattern><write state='");
>              print &xst_print_boolean_truefalse($$clients[1]);
>              print "'/></allow>\n";
>            }
> @@ -1504,14 +1504,14 @@
>        }
>  
>        &xst_xml_leave ();
> -      &xst_xml_print ("</export>\n");
> +      &xst_xml_print_line ("</export>\n");
>      }
>      
>    }
>    
> -  &xst_xml_vspace ();
> -  &xst_xml_print ("<!-- End of configuration -->\n");
> -  &xst_xml_vspace ();
> +  &xst_xml_print_vspace ();
> +  &xst_xml_print_line ("<!-- End of configuration -->\n");
> +  &xst_xml_print_vspace ();
>  
>    &xst_xml_leave ();
>    print "</shares>\n";


> Index: util.pl.in
> ===================================================================
> RCS file: /cvs/gnome/ximian-setup-tools/backends/util.pl.in,v
> retrieving revision 1.8
> diff -u -r1.8 util.pl.in
> --- util.pl.in	2001/03/22 10:04:46	1.8
> +++ util.pl.in	2001/03/28 15:23:14
> @@ -32,9 +32,9 @@
>  
>  sub xst_read_boolean
>  {
> -  if ($_[0] eq "true" ||
> -      $_[0] eq "yes" ||
> -      $_[0] eq "on")
> +  if ($_[0] =~ /true/i ||
> +      $_[0] =~ /yes/i ||
> +      $_[0] =~ /on/i)
>    {
>      return 1;
>    }

This part of the patch looks good.

I suggest you remove the part that will make the backend handle "homes" as a
share, fix the &xst_xml_print_indent()s and resubmit, if you need this to
work in CVS. Thanks.

--
Hans Petter

_______________________________________________
setup-tool-hackers maillist  -  setup-tool-hackers@helixcode.com
http://lists.helixcode.com/mailman/listinfo/setup-tool-hackers



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]