Blame SOURCES/krb5-CVE-2015-8631.patch

4afa59
From 83ed75feba32e46f736fcce0d96a0445f29b96c2 Mon Sep 17 00:00:00 2001
4afa59
From: Greg Hudson <ghudson@mit.edu>
4afa59
Date: Fri, 8 Jan 2016 13:16:54 -0500
4afa59
Subject: [PATCH 3/3] Fix leaks in kadmin server stubs [CVE-2015-8631]
4afa59
4afa59
In each kadmind server stub, initialize the client_name and
4afa59
server_name variables, and release them in the cleanup handler.  Many
4afa59
of the stubs will otherwise leak the client and server name if
4afa59
krb5_unparse_name() fails.  Also make sure to free the prime_arg
4afa59
variables in rename_principal_2_svc(), or we can leak the first one if
4afa59
unparsing the second one fails.  Discovered by Simo Sorce.
4afa59
4afa59
CVE-2015-8631:
4afa59
4afa59
In all versions of MIT krb5, an authenticated attacker can cause
4afa59
kadmind to leak memory by supplying a null principal name in a request
4afa59
which uses one.  Repeating these requests will eventually cause
4afa59
kadmind to exhaust all available memory.
4afa59
4afa59
    CVSSv2 Vector: AV:N/AC:L/Au:S/C:N/I:N/A:C/E:POC/RL:OF/RC:C
4afa59
4afa59
ticket: 8343 (new)
4afa59
target_version: 1.14-next
4afa59
target_version: 1.13-next
4afa59
tags: pullup
4afa59
---
4afa59
 src/kadmin/server/server_stubs.c | 151 ++++++++++++++++++++-------------------
4afa59
 1 file changed, 77 insertions(+), 74 deletions(-)
4afa59
4afa59
diff --git a/src/kadmin/server/server_stubs.c b/src/kadmin/server/server_stubs.c
4afa59
index 1879dc6..6ac797e 100644
4afa59
--- a/src/kadmin/server/server_stubs.c
4afa59
+++ b/src/kadmin/server/server_stubs.c
4afa59
@@ -334,7 +334,8 @@ create_principal_2_svc(cprinc_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret          ret;
4afa59
     char                        *prime_arg;
4afa59
-    gss_buffer_desc             client_name, service_name;
4afa59
+    gss_buffer_desc             client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc             service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                   minor_stat;
4afa59
     kadm5_server_handle_t       handle;
4afa59
     restriction_t               *rp;
4afa59
@@ -382,10 +383,10 @@ create_principal_2_svc(cprinc_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
     free(prime_arg);
4afa59
-    gss_release_buffer(&minor_stat, &client_name);
4afa59
-    gss_release_buffer(&minor_stat, &service_name);
4afa59
 
4afa59
 exit_func:
4afa59
+    gss_release_buffer(&minor_stat, &client_name);
4afa59
+    gss_release_buffer(&minor_stat, &service_name);
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -395,7 +396,8 @@ create_principal3_2_svc(cprinc3_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret          ret;
4afa59
     char                        *prime_arg;
4afa59
-    gss_buffer_desc             client_name, service_name;
4afa59
+    gss_buffer_desc             client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc             service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                   minor_stat;
4afa59
     kadm5_server_handle_t       handle;
4afa59
     restriction_t               *rp;
4afa59
@@ -444,10 +446,10 @@ create_principal3_2_svc(cprinc3_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
     free(prime_arg);
4afa59
-    gss_release_buffer(&minor_stat, &client_name);
4afa59
-    gss_release_buffer(&minor_stat, &service_name);
4afa59
 
4afa59
 exit_func:
4afa59
+    gss_release_buffer(&minor_stat, &client_name);
4afa59
+    gss_release_buffer(&minor_stat, &service_name);
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -457,8 +459,8 @@ delete_principal_2_svc(dprinc_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -501,10 +503,10 @@ delete_principal_2_svc(dprinc_arg *arg, struct svc_req *rqstp)
4afa59
 
4afa59
     }
4afa59
     free(prime_arg);
4afa59
-    gss_release_buffer(&minor_stat, &client_name);
4afa59
-    gss_release_buffer(&minor_stat, &service_name);
4afa59
 
4afa59
 exit_func:
4afa59
+    gss_release_buffer(&minor_stat, &client_name);
4afa59
+    gss_release_buffer(&minor_stat, &service_name);
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -514,8 +516,8 @@ modify_principal_2_svc(mprinc_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     restriction_t                   *rp;
4afa59
@@ -559,9 +561,9 @@ modify_principal_2_svc(mprinc_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -570,10 +572,9 @@ generic_ret *
4afa59
 rename_principal_2_svc(rprinc_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret          ret;
4afa59
-    char                        *prime_arg1,
4afa59
-        *prime_arg2;
4afa59
-    gss_buffer_desc             client_name,
4afa59
-        service_name;
4afa59
+    char                        *prime_arg1 = NULL, *prime_arg2 = NULL;
4afa59
+    gss_buffer_desc             client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc             service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                   minor_stat;
4afa59
     kadm5_server_handle_t       handle;
4afa59
     restriction_t               *rp;
4afa59
@@ -655,11 +656,11 @@ rename_principal_2_svc(rprinc_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
 
4afa59
     }
4afa59
+exit_func:
4afa59
     free(prime_arg1);
4afa59
     free(prime_arg2);
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -669,8 +670,8 @@ get_principal_2_svc(gprinc_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static gprinc_ret               ret;
4afa59
     char                            *prime_arg, *funcname;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -719,9 +720,9 @@ get_principal_2_svc(gprinc_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -731,8 +732,8 @@ get_princs_2_svc(gprincs_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static gprincs_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -777,9 +778,9 @@ get_princs_2_svc(gprincs_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
 
4afa59
     }
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -789,8 +790,8 @@ chpass_principal_2_svc(chpass_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -840,9 +841,9 @@ chpass_principal_2_svc(chpass_arg *arg, struct svc_req *rqstp)
4afa59
     }
4afa59
 
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -852,8 +853,8 @@ chpass_principal3_2_svc(chpass3_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -909,9 +910,9 @@ chpass_principal3_2_svc(chpass3_arg *arg, struct svc_req *rqstp)
4afa59
     }
4afa59
 
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -921,8 +922,8 @@ setv4key_principal_2_svc(setv4key_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -969,9 +970,9 @@ setv4key_principal_2_svc(setv4key_arg *arg, struct svc_req *rqstp)
4afa59
     }
4afa59
 
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -981,8 +982,8 @@ setkey_principal_2_svc(setkey_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -1029,9 +1030,9 @@ setkey_principal_2_svc(setkey_arg *arg, struct svc_req *rqstp)
4afa59
     }
4afa59
 
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1041,8 +1042,8 @@ setkey_principal3_2_svc(setkey3_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -1092,9 +1093,9 @@ setkey_principal3_2_svc(setkey3_arg *arg, struct svc_req *rqstp)
4afa59
     }
4afa59
 
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1106,8 +1107,8 @@ chrand_principal_2_svc(chrand_arg *arg, struct svc_req *rqstp)
4afa59
     krb5_keyblock               *k;
4afa59
     int                         nkeys;
4afa59
     char                        *prime_arg, *funcname;
4afa59
-    gss_buffer_desc             client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc             client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc             service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                   minor_stat;
4afa59
     kadm5_server_handle_t       handle;
4afa59
     const char                  *errmsg = NULL;
4afa59
@@ -1164,9 +1165,9 @@ chrand_principal_2_svc(chrand_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1178,8 +1179,8 @@ chrand_principal3_2_svc(chrand3_arg *arg, struct svc_req *rqstp)
4afa59
     krb5_keyblock               *k;
4afa59
     int                         nkeys;
4afa59
     char                        *prime_arg, *funcname;
4afa59
-    gss_buffer_desc             client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc             client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc             service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                   minor_stat;
4afa59
     kadm5_server_handle_t       handle;
4afa59
     const char                  *errmsg = NULL;
4afa59
@@ -1241,9 +1242,9 @@ chrand_principal3_2_svc(chrand3_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1253,8 +1254,8 @@ create_policy_2_svc(cpol_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -1295,9 +1296,9 @@ create_policy_2_svc(cpol_arg *arg, struct svc_req *rqstp)
4afa59
         if (errmsg != NULL)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1307,8 +1308,8 @@ delete_policy_2_svc(dpol_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -1347,9 +1348,9 @@ delete_policy_2_svc(dpol_arg *arg, struct svc_req *rqstp)
4afa59
         if (errmsg != NULL)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1359,8 +1360,8 @@ modify_policy_2_svc(mpol_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -1400,9 +1401,9 @@ modify_policy_2_svc(mpol_arg *arg, struct svc_req *rqstp)
4afa59
         if (errmsg != NULL)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1413,8 +1414,8 @@ get_policy_2_svc(gpol_arg *arg, struct svc_req *rqstp)
4afa59
     static gpol_ret             ret;
4afa59
     kadm5_ret_t         ret2;
4afa59
     char                        *prime_arg, *funcname;
4afa59
-    gss_buffer_desc             client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc             client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc             service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                   minor_stat;
4afa59
     kadm5_principal_ent_rec     caller_ent;
4afa59
     kadm5_server_handle_t       handle;
4afa59
@@ -1475,9 +1476,9 @@ get_policy_2_svc(gpol_arg *arg, struct svc_req *rqstp)
4afa59
         log_unauth(funcname, prime_arg,
4afa59
                    &client_name, &service_name, rqstp);
4afa59
     }
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 
4afa59
@@ -1488,8 +1489,8 @@ get_pols_2_svc(gpols_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static gpols_ret                ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -1531,9 +1532,9 @@ get_pols_2_svc(gpols_arg *arg, struct svc_req *rqstp)
4afa59
         if (errmsg != NULL)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1541,7 +1542,8 @@ exit_func:
4afa59
 getprivs_ret * get_privs_2_svc(krb5_ui_4 *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static getprivs_ret            ret;
4afa59
-    gss_buffer_desc                client_name, service_name;
4afa59
+    gss_buffer_desc                client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                      minor_stat;
4afa59
     kadm5_server_handle_t          handle;
4afa59
     const char                     *errmsg = NULL;
4afa59
@@ -1571,9 +1573,9 @@ getprivs_ret * get_privs_2_svc(krb5_ui_4 *arg, struct svc_req *rqstp)
4afa59
     if (errmsg != NULL)
4afa59
         krb5_free_error_message(handle->context, errmsg);
4afa59
 
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1583,7 +1585,8 @@ purgekeys_2_svc(purgekeys_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret          ret;
4afa59
     char                        *prime_arg, *funcname;
4afa59
-    gss_buffer_desc             client_name, service_name;
4afa59
+    gss_buffer_desc             client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc             service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                   minor_stat;
4afa59
     kadm5_server_handle_t       handle;
4afa59
 
4afa59
@@ -1629,9 +1632,9 @@ purgekeys_2_svc(purgekeys_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1641,8 +1644,8 @@ get_strings_2_svc(gstrings_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static gstrings_ret             ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -1688,9 +1691,9 @@ get_strings_2_svc(gstrings_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1700,8 +1703,8 @@ set_string_2_svc(sstring_arg *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret              ret;
4afa59
     char                            *prime_arg;
4afa59
-    gss_buffer_desc                 client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc                 client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc                 service_name = GSS_C_EMPTY_BUFFER;
4afa59
     OM_uint32                       minor_stat;
4afa59
     kadm5_server_handle_t           handle;
4afa59
     const char                      *errmsg = NULL;
4afa59
@@ -1744,9 +1747,9 @@ set_string_2_svc(sstring_arg *arg, struct svc_req *rqstp)
4afa59
             krb5_free_error_message(handle->context, errmsg);
4afa59
     }
4afa59
     free(prime_arg);
4afa59
+exit_func:
4afa59
     gss_release_buffer(&minor_stat, &client_name);
4afa59
     gss_release_buffer(&minor_stat, &service_name);
4afa59
-exit_func:
4afa59
     free_server_handle(handle);
4afa59
     return &ret;
4afa59
 }
4afa59
@@ -1754,8 +1757,8 @@ exit_func:
4afa59
 generic_ret *init_2_svc(krb5_ui_4 *arg, struct svc_req *rqstp)
4afa59
 {
4afa59
     static generic_ret         ret;
4afa59
-    gss_buffer_desc            client_name,
4afa59
-        service_name;
4afa59
+    gss_buffer_desc            client_name = GSS_C_EMPTY_BUFFER;
4afa59
+    gss_buffer_desc            service_name = GSS_C_EMPTY_BUFFER;
4afa59
     kadm5_server_handle_t      handle;
4afa59
     OM_uint32                  minor_stat;
4afa59
     const char                 *errmsg = NULL;
4afa59
@@ -1797,10 +1800,10 @@ generic_ret *init_2_svc(krb5_ui_4 *arg, struct svc_req *rqstp)
4afa59
                      rqstp->rq_cred.oa_flavor);
4afa59
     if (errmsg != NULL)
4afa59
         krb5_free_error_message(NULL, errmsg);
4afa59
-    gss_release_buffer(&minor_stat, &client_name);
4afa59
-    gss_release_buffer(&minor_stat, &service_name);
4afa59
 
4afa59
 exit_func:
4afa59
+    gss_release_buffer(&minor_stat, &client_name);
4afa59
+    gss_release_buffer(&minor_stat, &service_name);
4afa59
     return(&ret;;
4afa59
 }
4afa59
 
4afa59
-- 
4afa59
2.7.0.rc3
4afa59