svn commit: samba r23588 - in branches: SAMBA_3_0/source/libsmb
SAMBA_3_0_26/source/libsmb
gd at samba.org
gd at samba.org
Fri Jun 22 14:54:39 GMT 2007
Author: gd
Date: 2007-06-22 14:54:39 +0000 (Fri, 22 Jun 2007)
New Revision: 23588
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23588
Log:
Some more cleanups and error checks in the krb5 renew function.
Guenther
Modified:
branches/SAMBA_3_0/source/libsmb/clikrb5.c
branches/SAMBA_3_0_26/source/libsmb/clikrb5.c
Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/clikrb5.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clikrb5.c 2007-06-22 14:50:15 UTC (rev 23587)
+++ branches/SAMBA_3_0/source/libsmb/clikrb5.c 2007-06-22 14:54:39 UTC (rev 23588)
@@ -1151,6 +1151,11 @@
ccache_string = krb5_cc_default_name(context);
}
+ if (!ccache_string) {
+ ret = EINVAL;
+ goto done;
+ }
+
DEBUG(10,("smb_krb5_renew_ticket: using %s as ccache\n", ccache_string));
/* FIXME: we should not fall back to defaults */
@@ -1175,6 +1180,8 @@
{
krb5_creds creds;
+ ZERO_STRUCT(creds);
+
ret = krb5_get_renewed_creds(context, &creds, client, ccache, CONST_DISCARD(char *, service_string));
if (ret) {
DEBUG(10,("smb_krb5_renew_ticket: krb5_get_kdc_cred failed: %s\n", error_message(ret)));
@@ -1202,7 +1209,7 @@
krb5_realm *client_realm;
krb5_creds *creds;
- memset(&creds_in, 0, sizeof(creds_in));
+ ZERO_STRUCT(creds_in);
ret = krb5_copy_principal(context, client, &creds_in.client);
if (ret) {
@@ -1252,7 +1259,7 @@
krb5_free_creds(context, creds);
}
#else
-#error NO_SUITABKE_KRB5_TICKET_RENEW_FUNCTION_AVAILABLE
+#error NO_SUITABLE_KRB5_TICKET_RENEW_FUNCTION_AVAILABLE
#endif
@@ -1260,15 +1267,14 @@
if (client) {
krb5_free_principal(context, client);
}
+ if (ccache) {
+ krb5_cc_close(context, ccache);
+ }
if (context) {
krb5_free_context(context);
}
- if (ccache) {
- krb5_cc_close(context, ccache);
- }
return ret;
-
}
krb5_error_code smb_krb5_free_addresses(krb5_context context, smb_krb5_addresses *addr)
Modified: branches/SAMBA_3_0_26/source/libsmb/clikrb5.c
===================================================================
--- branches/SAMBA_3_0_26/source/libsmb/clikrb5.c 2007-06-22 14:50:15 UTC (rev 23587)
+++ branches/SAMBA_3_0_26/source/libsmb/clikrb5.c 2007-06-22 14:54:39 UTC (rev 23588)
@@ -1151,6 +1151,11 @@
ccache_string = krb5_cc_default_name(context);
}
+ if (!ccache_string) {
+ ret = EINVAL;
+ goto done;
+ }
+
DEBUG(10,("smb_krb5_renew_ticket: using %s as ccache\n", ccache_string));
/* FIXME: we should not fall back to defaults */
@@ -1175,6 +1180,8 @@
{
krb5_creds creds;
+ ZERO_STRUCT(creds);
+
ret = krb5_get_renewed_creds(context, &creds, client, ccache, CONST_DISCARD(char *, service_string));
if (ret) {
DEBUG(10,("smb_krb5_renew_ticket: krb5_get_kdc_cred failed: %s\n", error_message(ret)));
@@ -1202,7 +1209,7 @@
krb5_realm *client_realm;
krb5_creds *creds;
- memset(&creds_in, 0, sizeof(creds_in));
+ ZERO_STRUCT(creds_in);
ret = krb5_copy_principal(context, client, &creds_in.client);
if (ret) {
@@ -1252,7 +1259,7 @@
krb5_free_creds(context, creds);
}
#else
-#error NO_SUITABKE_KRB5_TICKET_RENEW_FUNCTION_AVAILABLE
+#error NO_SUITABLE_KRB5_TICKET_RENEW_FUNCTION_AVAILABLE
#endif
@@ -1260,15 +1267,14 @@
if (client) {
krb5_free_principal(context, client);
}
+ if (ccache) {
+ krb5_cc_close(context, ccache);
+ }
if (context) {
krb5_free_context(context);
}
- if (ccache) {
- krb5_cc_close(context, ccache);
- }
return ret;
-
}
krb5_error_code smb_krb5_free_addresses(krb5_context context, smb_krb5_addresses *addr)
More information about the samba-cvs
mailing list