Hello community,

here is the log from the commit of package yast2-nfs-client for 
openSUSE:Factory checked in at 2012-10-03 10:18:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-nfs-client (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-nfs-client.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-nfs-client", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-nfs-client/yast2-nfs-client.changes        
2012-09-10 15:21:22.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-nfs-client.new/yast2-nfs-client.changes   
2012-10-03 10:18:10.000000000 +0200
@@ -1,0 +2,8 @@
+Thu Sep 20 12:57:40 UTC 2012 - [email protected]
+
+- added support for IPv6 in square brackets
+- expanded testsuite for IPv6 checks
+- bnc#719538
+- 2.21.8 
+
+-------------------------------------------------------------------

Old:
----
  yast2-nfs-client-2.21.7.tar.bz2

New:
----
  yast2-nfs-client-2.21.8.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-nfs-client.spec ++++++
--- /var/tmp/diff_new_pack.0sVf2g/_old  2012-10-03 10:18:11.000000000 +0200
+++ /var/tmp/diff_new_pack.0sVf2g/_new  2012-10-03 10:18:11.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-nfs-client
-Version:        2.21.7
+Version:        2.21.8
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -25,7 +25,7 @@
 
 BuildRequires:  perl-XML-Writer
 BuildRequires:  update-desktop-files
-BuildRequires:  yast2
+BuildRequires:  yast2 >= 2.23.6
 BuildRequires:  yast2-devtools
 BuildRequires:  yast2-testsuite
 # yast2-nfs-client depends on nfs-utils in term that edits nfs-utils' options.
@@ -34,7 +34,7 @@
 BuildRequires:  nfs-client < 1.2.9
 #ag_showexports moved to yast2 base
 #Wizard::SetDesktopTitleAndIcon
-Requires:       yast2 >= 2.21.22
+Requires:       yast2 >= 2.23.6
 #idmapd_conf agent
 Requires:       yast2-nfs-common
 # showmount, #150382, #286300

++++++ yast2-nfs-client-2.21.7.tar.bz2 -> yast2-nfs-client-2.21.8.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-nfs-client-2.21.7/VERSION 
new/yast2-nfs-client-2.21.8/VERSION
--- old/yast2-nfs-client-2.21.7/VERSION 2012-08-27 09:55:05.000000000 +0200
+++ new/yast2-nfs-client-2.21.8/VERSION 2012-09-21 13:54:20.000000000 +0200
@@ -1 +1 @@
-2.21.7
+2.21.8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-nfs-client-2.21.7/src/routines.ycp 
new/yast2-nfs-client-2.21.8/src/routines.ycp
--- old/yast2-nfs-client-2.21.7/src/routines.ycp        2012-08-27 
11:57:13.000000000 +0200
+++ new/yast2-nfs-client-2.21.8/src/routines.ycp        2012-10-01 
10:42:15.000000000 +0200
@@ -24,16 +24,17 @@
     import "Package";
     import "Report";
     import "IP";
+    import "Hostname";
     import "String";
 
     /**
-     * @param spec     "server:/path/specification"
-     * @return         `couple("server", "/path/specification")
+     * @param spec      "server:/path/specification"
+     * @return          `couple("server", "/path/specification")
      */
     define term SpecToServPath(string spec) ``{
         // split using ":/" (because of IPv6)
         integer path_begin = search( spec, ":/");
-       string serv = "";
+        string serv = "";
 
         // no :/ inside => <server>: or [/]<path>
         if( path_begin == nil )
@@ -43,180 +44,200 @@
                 path_begin = size( spec) -1;
         }
 
-       if (path_begin != nil) {
-           serv = substring(spec, 0, path_begin);
-           spec = substring(spec, path_begin+1);
-       }
-       return `couple(serv, spec);
+        if (path_begin != nil) {
+            serv = substring(spec, 0, path_begin);
+            spec = substring(spec, path_begin+1);
+        }
+        return `couple(serv, spec);
     }
 
 
     /**
      * Creates a list of ui table items for nfs fstab entries
-     * @param fstab    list of nfs fstab entries
-     * @return         itemized table entries
+     * @param fstab     list of nfs fstab entries
+     * @return          itemized table entries
      * @example UI::ChangeWidget(`id(`fstable), `Items, 
FstabTableItems(nfs_entries));
      */
     define list<term> FstabTableItems(list<map> fstab) ``{
-       integer count = 0;
-       return maplist(map entry, fstab, ``{
-           term sp = SpecToServPath(entry["spec"]:"");
-           term it = `item(`id(count),
-                           sp[0]:"" + " ",
-                           sp[1]:"" + " ",
-                           entry["file"]:"" + " ",
-                           entry["vfstype"]:" ",
-                           entry["mntops"]:"" + " ");
-
-           count = count+1;
-           return it;
-       });
+        integer count = 0;
+        return maplist(map entry, fstab, ``{
+            term sp = SpecToServPath(entry["spec"]:"");
+            term it = `item(`id(count),
+                            sp[0]:"" + " ",
+                            sp[1]:"" + " ",
+                            entry["file"]:"" + " ",
+                            entry["vfstype"]:" ",
+                            entry["mntops"]:"" + " ");
+
+            count = count+1;
+            return it;
+        });
     }
 
     /**
      * Check for the validity of a hostname: nonempty, shorter than 50 chars,
      * [-A-Za-z._]. If invalid, a message is displayed.
-     * @param name     a hostname
-     * @return         whether valid
+     * @param name      a hostname
+     * @return          whether valid
      */
     define boolean CheckHostName(string name) ``{
-        string dirname_forbidden = ":";
 
-       if (size(name) > 0 &&
-           size(name) < 50 &&
-           name == filterchars(name, "-_.:" + String::CAlnum() )) {
-            if( IP::Check( name))
+        y2milestone( "CheckHostName: hostname=%1", name);
+
+        if (size(name) > 0 &&
+            size(name) < 50)
+        {
+            if( IP::Check4( name))
                 return true;
-            if( "" != filterchars( name, dirname_forbidden))
-                return false;
+            if( IP::Check6( IP::UndecorateIPv6( name)))
+                return true;
+            if( Hostname::CheckDomain( name))
+                return true;
+        }
 
-           return true;
-       } else
-           // error popup message
-           Report::Error (sformat(_("The hostname entered is invalid. It must 
be
+        // error popup message
+
+        Report::Error ( sformat(_("The hostname entered is invalid. It must be
 shorter than 50 characters and only use
-0-9, A-Z, a-z, dots, -, and _.:")));
-       return false;
+valid IPv4, IPv6 or domain name.
+Valid IPv4: %1
+Valid IPv6: %2
+Valid domain: %3"), IP::Valid4(), IP::Valid6(), Hostname::ValidDomain()) );
+
+        return false;
     };
 
     /**
      * Check if a mountpoint is in the fstab. If yes, display a message.
-     * @param fstab    in .etc.fstab format (must contain the key "file")
-     * @param mpoint   mount point
-     * @return         is it there?
+     * @param fstab     in .etc.fstab format (must contain the key "file")
+     * @param mpoint    mount point
+     * @return          is it there?
      */
     define boolean IsMpInFstab(list<map> fstab, string mpoint) ``{
-       list tmp = filter(map fse, fstab, ``{
-           return (fse["file"]:"" == mpoint);
-       });
-
-       if (size(tmp) == 0)
-           return false;
-       else
-           // error popup message
-           Report::Error (sformat(_("fstab already contains an entry
+        list tmp = filter(map fse, fstab, ``{
+            return (fse["file"]:"" == mpoint);
+        });
+
+        if (size(tmp) == 0)
+            return false;
+        else
+            // error popup message
+            Report::Error (sformat(_("fstab already contains an entry
 with mount point '%1'."), mpoint));
-       return true;
+        return true;
     };
 
     /**
      * Check for the validity of a path/mountpoint:
      * nonempty, fewer than 70 chars, starts with a slash.
      * If invalid, a message is displayed.
-     * @param name     path
-     * @return         whether valid
+     * @param name      path
+     * @return          whether valid
      */
     define boolean CheckPath(string name) ``{
-       if (size(name) > 0 &&
-           size(name) < 70 &&
-           substring(name, 0, 1) == "/")
-       {
-           return true;
-       }
+        if (size(name) > 0 &&
+            size(name) < 70 &&
+            substring(name, 0, 1) == "/")
+        {
+            return true;
+        }
 
-       // error popup message (spaces are now allowed)
-       Report::Error (sformat(_("The path entered is invalid.
+        // error popup message (spaces are now allowed)
+        Report::Error (sformat(_("The path entered is invalid.
 It must be shorter than 70 characters
 and it must begin with a slash (/).")));
-       return false;
+        return false;
     };
 
     /**
      * Checks the nfs options for /etc/fstab:
      * nonempty, comma separated list of foo,nofoo,bar=baz (see nfs(5))
-     * @param options  options
-     * @return         a translated string with error message, emtpy string if 
ok
+     * @param options   options
+     * @return          a translated string with error message, emtpy string 
if ok
      */
     define string check_options (string options) ``{
 
-       // To translators: error popup
-       if (size (options) == 0)   return _("Empty option strings are not 
allowed.");
-       if (options == "defaults") return "";
+        // To translators: error popup
+        if (size (options) == 0)   return _("Empty option strings are not 
allowed.");
+        if (options == "defaults") return "";
 
 
-       list<string> option_list = splitstring (options, ",");
+        list<string> option_list = splitstring (options, ",");
 
 //the options must be easy to sync with mount.c and nfsmount.c
 
-       // these can be negated by "no"
-       list<string> non_value   = ["bg", "fg", "soft", "hard", "intr", 
"posix", "cto", "ac", "acl",
-                           "lock", "tcp", "udp", "rdirplus", "sharecache", 
"resvport", "fsc",
-                           // these are common for all fs types
-                           "atime", "auto", "dev", "exec", "group", "owner",
-                           "suid", "user", "users", "sub", "mand", "loop", 
"diratime", "relatime",
+        // these can be negated by "no"
+        list<string> non_value   = ["bg", "fg", "soft", "hard", "intr", 
"posix", "cto", "ac", "acl",
+                            "lock", "tcp", "udp", "rdirplus", "sharecache", 
"resvport", "fsc",
+                            // these are common for all fs types
+                            "atime", "auto", "dev", "exec", "group", "owner",
+                            "suid", "user", "users", "sub", "mand", "loop", 
"diratime", "relatime",
                             "quota", ];
-       // these cannot be negated
-       // they are not nfs specific BTW
-       list non_value1 = ["defaults", "async", "sync", "dirsync", "ro", "rw",
-                          "remount", "bind", "rbind", "_netdev", "nofail", 
"rdma", 
+        // these cannot be negated
+        // they are not nfs specific BTW
+        list non_value1 = ["defaults", "async", "sync", "dirsync", "ro", "rw",
+                           "remount", "bind", "rbind", "_netdev", "nofail", 
"rdma", 
                            "quiet", "loud", "usrquota", "grpquota", ];
-       list with_value  = ["rsize", "wsize", "timeo", "retrans", "acregmin", 
"acregmax",
-                           "acdirmin", "acdirmax", "actimeo", "retry", 
"namlen",
-                           "port", "proto", "clientaddr", "mountport", 
"mountproto", "mounthost",
-                           "mountprog", "mountvers", "nfsprog", "nfsvers", 
"vers", "sec",
+        list with_value  = ["rsize", "wsize", "timeo", "retrans", "acregmin", 
"acregmax",
+                            "acdirmin", "acdirmax", "actimeo", "retry", 
"namlen",
+                            "port", "proto", "clientaddr", "mountport", 
"mountproto", "mounthost",
+                            "mountprog", "mountvers", "nfsprog", "nfsvers", 
"vers", "sec",
                             "comment", "lookupcache", "local_lock", ];
-       integer i = 0;
-       string current_option = "";
+        integer i = 0;
+        string current_option = "";
 
-       // first fiter out non value options and its nooptions forms (see 
nfs(5))
-       option_list = filter (string e, option_list, ``(!contains (non_value, 
e)));
-       non_value   = maplist (string e, non_value, ``(sformat ("no%1", e)));
-       option_list = filter (string e, option_list, ``(!contains (non_value, 
e)));
-       option_list = filter (string e, option_list, ``(!contains (non_value1, 
e)));
-
-       while (i < size (option_list))
-       {
-           string opt = option_list[i]:"";
-           list<string> value = splitstring (opt, "=");
-           string v0 = value[0]:"";
-           string v1 = value[1]:"";
-           // FIXME: this also triggers for "intr=bogus"
-           // To translators: error popup
-           if (!contains (with_value, v0)) return sformat (_("Unknown option: 
%1"), v0);
-           // To translators: error popup
-           if (size (value) != 2) return sformat (_("Invalid option: %1"), 
opt);
-           // To translators: error popup
-           if (v1 == "") return sformat (_("Empty value for option: %1"), v0);
-           i = i + 1;
-       }
+        // first fiter out non value options and its nooptions forms (see 
nfs(5))
+        option_list = filter (string e, option_list, ``(!contains (non_value, 
e)));
+        non_value   = maplist (string e, non_value, ``(sformat ("no%1", e)));
+        option_list = filter (string e, option_list, ``(!contains (non_value, 
e)));
+        option_list = filter (string e, option_list, ``(!contains (non_value1, 
e)));
 
-       return "";
+        while (i < size (option_list))
+        {
+            string opt = option_list[i]:"";
+            list<string> value = splitstring (opt, "=");
+            string v0 = value[0]:"";
+            string v1 = value[1]:"";
+            // FIXME: this also triggers for "intr=bogus"
+            // To translators: error popup
+            if (!contains (with_value, v0)) return sformat (_("Unknown option: 
%1"), v0);
+            // To translators: error popup
+            if (size (value) != 2) return sformat (_("Invalid option: %1"), 
opt);
+            // To translators: error popup
+            if (v1 == "") return sformat (_("Empty value for option: %1"), v0);
+            i = i + 1;
+        }
+
+        return "";
     }
 
     /**
      * Strips a superfluous slash off the end of a pathname.
-     * @param  p       pathname
-     * @return         stripped pathname
+     * @param   p       pathname
+     * @return          stripped pathname
      */
     define string StripExtraSlash (string p) ``{
-       if (regexpmatch (p, "^.+/$"))
-       {
-           return regexpsub (p, "^(.+)/$", "\\1");
-       }
-       else
-       {
-           return p;
-       }
+        if (regexpmatch (p, "^.+/$"))
+        {
+            return regexpsub (p, "^(.+)/$", "\\1");
+        }
+        else
+        {
+            return p;
+        }
+    }
+
+    /**
+     * Formats hostname into form suitable for fstab.
+     * If given param is IPv6 then encloses it into square brackets.
+     */
+    define string FormatHostnameForFstab( string hostname)
+    {
+        y2milestone( "FormatHostnameForFstab: hostname=%1", hostname);
+
+        if( IP::Check6( IP::UndecorateIPv6( hostname)))
+            return sformat( regexpmatch( hostname, "\\[.*\\]") ? "%1" : 
"[%1]", hostname);
+        return hostname; 
     }
 
     /**
@@ -224,6 +245,6 @@
      * @return boolean true if portmap is installed
      */
     define boolean IsPortmapperInstalled( string portmapper ) ``{
-       return Package::Install( portmapper );
+        return Package::Install( portmapper );
     }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-nfs-client-2.21.7/src/ui.ycp 
new/yast2-nfs-client-2.21.8/src/ui.ycp
--- old/yast2-nfs-client-2.21.7/src/ui.ycp      2012-06-20 13:28:44.000000000 
+0200
+++ new/yast2-nfs-client-2.21.8/src/ui.ycp      2012-09-21 13:52:33.000000000 
+0200
@@ -408,7 +408,7 @@
            }
            else if (ret == `ok)
            {
-               server = (string) UI::QueryWidget(`id(`serverent), `Value);
+               server = FormatHostnameForFstab( (string) 
UI::QueryWidget(`id(`serverent), `Value));
                pth = StripExtraSlash ((string) UI::QueryWidget(`id(`pathent), 
`Value));
                mount = StripExtraSlash ((string) 
UI::QueryWidget(`id(`mountent), `Value));
                nfs4 = (boolean) UI::QueryWidget(`id(`nfs4), `Value);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-nfs-client-2.21.7/testsuite/tests/r-check.out 
new/yast2-nfs-client-2.21.8/testsuite/tests/r-check.out
--- old/yast2-nfs-client-2.21.7/testsuite/tests/r-check.out     2012-06-20 
13:28:44.000000000 +0200
+++ new/yast2-nfs-client-2.21.8/testsuite/tests/r-check.out     2012-10-01 
10:42:15.000000000 +0200
@@ -17,3 +17,14 @@
 Return true
 Return false
 Return true
+Return false
+Return true
+Return false
+Return true
+Return true
+Return false
+Dump   FormatHostnameForFstab
+Return [::1]
+Return [::1]
+Return 127.0.0.1
+Return suse.de
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-nfs-client-2.21.7/testsuite/tests/r-check.ycp 
new/yast2-nfs-client-2.21.8/testsuite/tests/r-check.ycp
--- old/yast2-nfs-client-2.21.7/testsuite/tests/r-check.ycp     2012-06-20 
13:28:44.000000000 +0200
+++ new/yast2-nfs-client-2.21.8/testsuite/tests/r-check.ycp     2012-10-01 
10:42:15.000000000 +0200
@@ -16,12 +16,18 @@
     include "testsuite.ycp";
     include "nfs/routines.ycp";
 
-    string OK_Name     = "foo.bar.com.tw";
-    string TooLongName = 
"123456789012345678901234567890123456789012345678901234567890";
-    string IllegalName = "Something:wrong";
-    string IPv4        = "192.168.10.1";
-    string IPv4_invalid= "192.168.10:1";
-    string IPv6        = "fe80::219:d1ff:feac:fd10";
+    string OK_Name                 = "foo.bar.com.tw";
+    string TooLongName             = 
"123456789012345678901234567890123456789012345678901234567890";
+    string IllegalName             = "Something:wrong";
+    string IPv4                    = "192.168.10.1";
+    string IPv4_invalid            = "192.168.10:1";
+    string IPv6                    = "fe80::219:d1ff:feac:fd10";
+    string IPv6_invalid            = "fe80::219::fd10";
+    string IPv6_brackets           = "[::1]";
+    string IPv6_brackets_invalid   = "[::1";
+    string IPv6_link_local_nb      = "fe80::3%eth0";
+    string IPv6_link_local_ib      = "[fe80::3%eth0]";
+    string IPv6_link_local_invalid = "[fe80::3%]";
 
     DUMP ("check_options");
     TEST (``(check_options ("")), [], nil);
@@ -45,4 +51,16 @@
     TEST (``(CheckHostName (IPv4)), [], nil);
     TEST (``(CheckHostName (IPv4_invalid)), [], nil);
     TEST (``(CheckHostName (IPv6)), [], nil);
+    TEST (``(CheckHostName (IPv6_invalid)), [], nil);
+    TEST (``(CheckHostName (IPv6_brackets)), [], nil);
+    TEST (``(CheckHostName (IPv6_brackets_invalid)), [], nil);
+    TEST (``(CheckHostName (IPv6_link_local_nb)), [], nil);
+    TEST (``(CheckHostName (IPv6_link_local_ib)), [], nil);
+    TEST (``(CheckHostName (IPv6_link_local_invalid)), [], nil);
+
+    DUMP ( "FormatHostnameForFstab");
+    TEST ( FormatHostnameForFstab( "::1"), [], nil);
+    TEST ( FormatHostnameForFstab( "[::1]"), [], nil);
+    TEST ( FormatHostnameForFstab( "127.0.0.1"), [], nil);
+    TEST ( FormatHostnameForFstab( "suse.de"), [], nil);
 }

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to