[Freeipa-devel] [PATCH 0047] Fix uninitialized variables in replicainstall

2016-06-16 Thread Stanislav Laznicka

Hello,

There was a possible use of uninitialized variables in replicainstall.

From 1b26d42e00506b007e087c74cafc0327090aec40 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka 
Date: Thu, 16 Jun 2016 10:05:34 +0200
Subject: [PATCH] Fix unitialized variables in replicainstall

ipaconf and target_fname variables would have been used uninitialized in finally block
should an exception occur in the try block before their initialization.
---
 ipaserver/install/server/replicainstall.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py
index f597880471eb3710ebc7163f771d4e6dc9f1e3d6..8864944d814239eec82c8c5d862f0f9ca04b23d2 100644
--- a/ipaserver/install/server/replicainstall.py
+++ b/ipaserver/install/server/replicainstall.py
@@ -1304,10 +1304,12 @@ def promote(installer):
 http_pkcs12_info = installer._http_pkcs12_info
 pkinit_pkcs12_file = installer._pkinit_pkcs12_file
 pkinit_pkcs12_info = installer._pkinit_pkcs12_info
+target_fname = paths.IPA_DEFAULT_CONF
 
 ccache = os.environ['KRB5CCNAME']
 remote_api = installer._remote_api
 conn = remote_api.Backend.ldap2
+ipaconf = ipaclient.ipachangeconf.IPAChangeConf("IPA Replica Promote")
 try:
 conn.connect(ccache=installer._ccache)
 
@@ -1318,9 +1320,7 @@ def promote(installer):
 )
 
 # Save client file and merge in server directives
-target_fname = paths.IPA_DEFAULT_CONF
 fstore.backup_file(target_fname)
-ipaconf = ipaclient.ipachangeconf.IPAChangeConf("IPA Replica Promote")
 ipaconf.setOptionAssignment(" = ")
 ipaconf.setSectionNameDelimiters(("[", "]"))
 
-- 
2.5.5

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [PATCH 0047] Fix uninitialized variables in replicainstall

2016-06-20 Thread Stanislav Laznicka

On 06/16/2016 10:16 AM, Stanislav Laznicka wrote:

Hello,

There was a possible use of uninitialized variables in replicainstall.



Discard the patch, Martin sent the same patch yesterday but Honza seems 
to have already taken care of it.


-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code