]> xenbits.xensource.com Git - libvirt.git/commitdiff
phyp: Reorder keyboard_interactive label in openSSHSession()
authorEduardo Otubo <otubo@linux.vnet.ibm.com>
Wed, 11 Nov 2009 01:45:51 +0000 (02:45 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Wed, 11 Nov 2009 01:49:27 +0000 (02:49 +0100)
Finish changes intended to be part of commit
6c70802374d1cb9316769fea750a6c2c198901ff

src/phyp/phyp_driver.c

index e9f0feca8833103230f28efddd692b39fa98fc25..b73ea101c4a3274c8543c47a883f90e334838b88 100644 (file)
@@ -255,11 +255,6 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
     char *pvtkey = NULL;
     char *userhome = virGetUserDirectory(NULL, geteuid());
     struct stat pvt_stat, pub_stat;
-    int i;
-    int hasPassphrase = 0;
-    virConnectCredential creds[] = {
-        {VIR_CRED_PASSPHRASE, "password", "Password", NULL, NULL, 0},
-    };
 
     if (userhome == NULL)
         goto err;
@@ -324,8 +319,10 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
     }
 
     /* Trying authentication by pubkey */
-    if (stat(pvtkey, &pvt_stat) || stat(pubkey, &pub_stat))
+    if (stat(pvtkey, &pvt_stat) || stat(pubkey, &pub_stat)) {
+        rc = LIBSSH2_ERROR_SOCKET_NONE;
         goto keyboard_interactive;
+    }
 
     while ((rc =
             libssh2_userauth_publickey_fromfile(session, username,
@@ -334,10 +331,16 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
                                                 NULL)) ==
            LIBSSH2_ERROR_EAGAIN) ;
 
+  keyboard_interactive:
     if (rc == LIBSSH2_ERROR_SOCKET_NONE
         || rc == LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED
         || rc == LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED) {
-  keyboard_interactive:
+        int i;
+        int hasPassphrase = 0;
+
+        virConnectCredential creds[] = {
+            {VIR_CRED_PASSPHRASE, "password", "Password", NULL, NULL, 0},
+        };
 
         if (!auth || !auth->cb) {
             PHYP_ERROR(conn, VIR_ERR_AUTH_FAILED,