File pysmbc-bnc433994-crash.patch of Package system-config-printer

diff -U0 pysmbc-1.0.5/ChangeLog.git pysmbc-1.0.5/ChangeLog
--- pysmbc-1.0.5/ChangeLog.git	2008-08-29 10:33:35.000000000 +0100
+++ pysmbc-1.0.5/ChangeLog	2008-10-17 10:10:28.000000000 +0100
@@ -0,0 +1,11 @@
+2008-10-17  Tim Waugh  <twaugh@redhat.com>
+
+	* dir.c (Dir_getdents): Fixed crash when getdents provides more
+	than one batch of entries (bug #465975).
+
+2008-10-08  Tim Waugh  <twaugh@redhat.com>
+
+	* test.py (Browser.__init__): Prevent unbound local variable
+	traceback when the auth dialog is cancelled.
+	(Browser.row_expanded): Likewise.
+
diff -up pysmbc-1.0.5/dir.c.git pysmbc-1.0.5/dir.c
--- pysmbc-1.0.5/dir.c.git	2008-06-09 13:19:54.000000000 +0100
+++ pysmbc-1.0.5/dir.c	2008-10-17 10:10:28.000000000 +0100
@@ -114,12 +114,10 @@ Dir_getdents (Dir *self)
   SMBCCTX *ctx;
   char dirbuf[1024];
   smbc_getdents_fn fn;
-  struct smbc_dirent *dirp;
   int dirlen;
 
   debugprintf ("-> Dir_getdents()\n");
   ctx = self->context->context;
-  dirp = (struct smbc_dirent *) dirbuf;
   listobj = PyList_New (0);
   fn = smbc_getFunctionGetdents (ctx);
   errno = 0;
@@ -127,6 +125,8 @@ Dir_getdents (Dir *self)
 			  (struct smbc_dirent *) dirbuf,
 			  sizeof (dirbuf))) != 0)
     {
+      struct smbc_dirent *dirp;
+
       debugprintf ("dirlen = %d\n", dirlen);
       if (dirlen < 0)
 	{
@@ -136,6 +136,7 @@ Dir_getdents (Dir *self)
 	  return NULL;
 	}
 
+      dirp = (struct smbc_dirent *) dirbuf;
       while (dirlen > 0)
 	{
 	  PyObject *dent;
diff -up pysmbc-1.0.5/test.py.git pysmbc-1.0.5/test.py
--- pysmbc-1.0.5/test.py.git	2008-05-21 17:04:07.000000000 +0100
+++ pysmbc-1.0.5/test.py	2008-10-17 10:10:28.000000000 +0100
@@ -146,6 +146,7 @@ class Browser:
         ctx.optionNoAutoAnonymousLogin = True
         self.smbc = ctx
         self.auth = AuthContext (w)
+        workgroups = None
         try:
             while self.auth.perform_authentication () > 0:
                 try:
@@ -153,9 +154,7 @@ class Browser:
                 except Exception, e:
                     self.auth.failed (e)
         except RuntimeError, (e, s):
-            if e == errno.ENOENT:
-                workgroups = None
-            else:
+            if e != errno.ENOENT:
                 raise
 
         if workgroups:
@@ -201,6 +200,7 @@ class Browser:
 
             uri = "smb://%s" % entry.name
             self.auth = AuthContext (self.main)
+            servers = None
             try:
                 while self.auth.perform_authentication () > 0:
                     try:
@@ -208,9 +208,7 @@ class Browser:
                     except Exception, e:
                         self.auth.failed (e)
             except RuntimeError, (e, s):
-                if e == errno.ENOENT:
-                    servers = None
-                else:
+                if e != errno.ENOENT:
                     raise
 
             if servers:
@@ -235,6 +233,7 @@ class Browser:
             uri = "smb://%s" % entry.name
 
             self.auth = AuthContext (self.main)
+            shares = None
             try:
                 while self.auth.perform_authentication () > 0:
                     try:
@@ -242,7 +241,6 @@ class Browser:
                     except Exception, e:
                         self.auth.failed (e)
             except RuntimeError, (e, s):
-                shares = None
                 if e != errno.EACCES and e != errno.EPERM:
                     del self.expanding_row
                     raise

openSUSE Build Service is sponsored by