[PATCH] [s3] set proper ads_keytab_flush() return code on error

Ralph Böhme slow at samba.org
Wed Nov 21 10:14:11 UTC 2018


Hi Swen,

On Wed, Nov 21, 2018 at 11:06:55AM +0100, swen via samba-technical wrote:
>Please review and push if happy.

oh, good catch, how did you find that?

One thing, see inline below:

>Thanks for your support in advance.
>
>Cheers Swen

>From 407f612775421efbfcd887823e7866516e7f4131 Mon Sep 17 00:00:00 2001
>From: Swen Schillig <swen at linux.ibm.com>
>Date: Wed, 21 Nov 2018 10:59:31 +0100
>Subject: [PATCH] [s3] set proper ads_keytab_flush() return code on error
>
>The return code was left on success when the calls to
>ads_get_machine_kvno() or ads_clear_service_principal_names()
>failed and the processing had to be aborted.
>
>Signed-off-by: Swen Schillig <swen at linux.ibm.com>
>---
> source3/libads/kerberos_keytab.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
>index 63c1f2bb369..e9eb1cf71c6 100644
>--- a/source3/libads/kerberos_keytab.c
>+++ b/source3/libads/kerberos_keytab.c
>@@ -457,6 +457,7 @@ int ads_keytab_flush(ADS_STRUCT *ads)
> 	if (kvno == -1) {
> 		/* -1 indicates a failure */
> 		DEBUG(1, (__location__ ": Error determining the kvno.\n"));
>+		ret = -1;
> 		goto out;
> 	}
>
>@@ -477,7 +478,7 @@ int ads_keytab_flush(ADS_STRUCT *ads)
> 	if (!ADS_ERR_OK(aderr)) {
> 		DEBUG(1, (__location__ ": Error while clearing service "
> 			  "principal listings in LDAP.\n"));
>-		goto out;
>+		ret = -1;
> 	}
>
> out:

I guess this should also use 

		ret = -1;
 		goto out;

otherwise the next person to add code after the if and before the out might not 
notice that there's no goto out.

What do you think?

-slow

-- 
Ralph Boehme, Samba Team       https://samba.org/
Samba Developer, SerNet GmbH   https://sernet.de/en/samba/
GPG Key Fingerprint:           FAE2 C608 8A24 2520 51C5
                               59E4 AA1E 9B71 2639 9E46



More information about the samba-technical mailing list