Check for NULL pointers before dereferencing them.
authorDerrell Lipman <derrell.lipman@unwireduniverse.com>
Thu, 6 Mar 2008 14:00:37 +0000 (09:00 -0500)
committerDerrell Lipman <derrell.lipman@unwireduniverse.com>
Thu, 6 Mar 2008 14:00:37 +0000 (09:00 -0500)
(This used to be commit 6f65390cec218a6aac4370ee381f30439617dcec)

source3/libsmb/libsmb_server.c

index 64eb1ea58418c32e47a7fd0dd0216c1402f4f3b0..37612c6e39f076076f968486158a8db0bb7b1ba6 100644 (file)
@@ -144,6 +144,10 @@ SMBC_find_server(TALLOC_CTX *ctx,
         SMBCSRV *srv;
         int auth_called = 0;
         
+        if (!pp_workgroup || !pp_username || !pp_password) {
+                return NULL;
+        }
+                
 check_server_cache:
         
        srv = smbc_getFunctionGetCachedServer(context)(context,
@@ -156,10 +160,6 @@ check_server_cache:
                SMBC_call_auth_fn(ctx, context, server, share,
                                   pp_workgroup, pp_username, pp_password);
                 
-               if (!pp_workgroup || !pp_username || !pp_password) {
-                       return NULL;
-               }
-                
                /*
                  * However, smbc_auth_fn may have picked up info relating to
                  * an existing connection, so try for an existing connection