[PATCH] Put base64.c on a dependency diet

Jeremy Allison jra at samba.org
Tue May 3 19:09:17 UTC 2016


On Tue, May 03, 2016 at 05:09:41PM +0200, Volker Lendecke wrote:
> Hi!
> 
> Review appreciated!
> 

Nice cleanup Volker - pushed !

> -- 
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: +49-551-370000-0, fax: +49-551-370000-9
> AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
> http://www.sernet.de, mailto:kontakt at sernet.de

> From 6fbf4d8d2d2bf188a782c2dea55e7924f406bb94 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Fri, 25 Mar 2016 21:43:20 +0100
> Subject: [PATCH 1/6] lib: The base64 chars are by definition single-byte :-)
> 
> Remove a dependency on charcnv
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  lib/util/base64.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/util/base64.c b/lib/util/base64.c
> index bc78404..de26b5b 100644
> --- a/lib/util/base64.c
> +++ b/lib/util/base64.c
> @@ -38,7 +38,7 @@ _PUBLIC_ DATA_BLOB base64_decode_data_blob_talloc(TALLOC_CTX *mem_ctx, const cha
>  
>  	n=i=0;
>  
> -	while (*s && (p=strchr_m(b64,*s))) {
> +	while (*s && (p=strchr(b64,*s))) {
>  		idx = (int)(p - b64);
>  		byte_offset = (i*6)/8;
>  		bit_offset = (i*6)%8;
> -- 
> 1.9.1
> 
> 
> From 5c34cdfd91e9221692c792af2ec493788acdc377 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Fri, 25 Mar 2016 21:43:57 +0100
> Subject: [PATCH 2/6] lib: =0 and |= is equivalent to =
> 
> Just a small simplication I thought might be nice
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  lib/util/base64.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/util/base64.c b/lib/util/base64.c
> index de26b5b..a4ce6fa 100644
> --- a/lib/util/base64.c
> +++ b/lib/util/base64.c
> @@ -48,8 +48,7 @@ _PUBLIC_ DATA_BLOB base64_decode_data_blob_talloc(TALLOC_CTX *mem_ctx, const cha
>  			n = byte_offset+1;
>  		} else {
>  			d[byte_offset] |= (idx >> (bit_offset-2));
> -			d[byte_offset+1] = 0;
> -			d[byte_offset+1] |= (idx << (8-(bit_offset-2))) & 0xFF;
> +			d[byte_offset+1] = (idx << (8-(bit_offset-2))) & 0xFF;
>  			n = byte_offset+2;
>  		}
>  		s++; i++;
> -- 
> 1.9.1
> 
> 
> From db05eb8f2fad59acf78dc0c86e9718d5c67b474b Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 3 May 2016 15:54:07 +0200
> Subject: [PATCH 3/6] lib: Make callers of base64_encode_data_blob check for
>  success
> 
> Quite a few callers already did check for !=NULL. With the current code this is
> pointless due to a SMB_ASSERT in base64_encode_data_blob() itself. Make the
> callers consistently check, so that we can remove SMB_ASSERT from base64.c.
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  source3/libnet/libnet_dssync_passdb.c   | 10 +++++++---
>  source3/libnet/libnet_samsync_passdb.c  |  9 ++++++---
>  source3/rpc_server/samr/srv_samr_util.c | 22 +++++++++++++++-------
>  source3/utils/ntlm_auth.c               |  2 ++
>  source4/utils/ntlm_auth.c               |  2 ++
>  5 files changed, 32 insertions(+), 13 deletions(-)
> 
> diff --git a/source3/libnet/libnet_dssync_passdb.c b/source3/libnet/libnet_dssync_passdb.c
> index 5617776..62ce074 100644
> --- a/source3/libnet/libnet_dssync_passdb.c
> +++ b/source3/libnet/libnet_dssync_passdb.c
> @@ -1240,10 +1240,14 @@ static NTSTATUS sam_account_from_object(struct samu *account,
>  	}
>  
>  	if (userParameters.data) {
> -		char *newstr;
> +		char *newstr = NULL;
>  		old_string = pdb_get_munged_dial(account);
> -		newstr = (userParameters.length == 0) ? NULL :
> -			base64_encode_data_blob(talloc_tos(), userParameters);
> +
> +		if (userParameters.length != 0) {
> +			newstr = base64_encode_data_blob(talloc_tos(),
> +							 userParameters);
> +			SMB_ASSERT(newstr != NULL);
> +		}
>  
>  		if (STRING_CHANGED_NC(old_string, newstr))
>  			pdb_set_munged_dial(account, newstr, PDB_CHANGED);
> diff --git a/source3/libnet/libnet_samsync_passdb.c b/source3/libnet/libnet_samsync_passdb.c
> index cf5bef1..5185722 100644
> --- a/source3/libnet/libnet_samsync_passdb.c
> +++ b/source3/libnet/libnet_samsync_passdb.c
> @@ -126,12 +126,15 @@ static NTSTATUS sam_account_from_delta(struct samu *account,
>  
>  	if (r->parameters.array) {
>  		DATA_BLOB mung;
> -		char *newstr;
> +		char *newstr = NULL;
>  		old_string = pdb_get_munged_dial(account);
>  		mung.length = r->parameters.length * 2;
>  		mung.data = (uint8_t *) r->parameters.array;
> -		newstr = (mung.length == 0) ? NULL :
> -			base64_encode_data_blob(talloc_tos(), mung);
> +
> +		if (mung.length != 0) {
> +			newstr = base64_encode_data_blob(talloc_tos(), mung);
> +			SMB_ASSERT(newstr != NULL);
> +		}
>  
>  		if (STRING_CHANGED_NC(old_string, newstr))
>  			pdb_set_munged_dial(account, newstr, PDB_CHANGED);
> diff --git a/source3/rpc_server/samr/srv_samr_util.c b/source3/rpc_server/samr/srv_samr_util.c
> index d052846..4c2307d 100644
> --- a/source3/rpc_server/samr/srv_samr_util.c
> +++ b/source3/rpc_server/samr/srv_samr_util.c
> @@ -305,8 +305,6 @@ void copy_id18_to_sam_passwd(struct samu *to,
>  void copy_id20_to_sam_passwd(struct samu *to,
>  			     struct samr_UserInfo20 *from)
>  {
> -	const char *old_string;
> -	char *new_string;
>  	DATA_BLOB mung;
>  
>  	if (from == NULL || to == NULL) {
> @@ -314,11 +312,18 @@ void copy_id20_to_sam_passwd(struct samu *to,
>  	}
>  
>  	if (from->parameters.array) {
> +		const char *old_string;
> +		char *new_string = NULL;
>  		old_string = pdb_get_munged_dial(to);
>  		mung = data_blob_const(from->parameters.array,
>  				       from->parameters.length);
> -		new_string = (mung.length == 0) ?
> -			NULL : base64_encode_data_blob(talloc_tos(), mung);
> +
> +		if (mung.length != 0) {
> +			new_string = base64_encode_data_blob(talloc_tos(),
> +							     mung);
> +			SMB_ASSERT(new_string != NULL);
> +		}
> +
>  		DEBUG(10,("INFO_20 PARAMETERS: %s -> %s\n",
>  			old_string, new_string));
>  		if (STRING_CHANGED_NC(old_string,new_string)) {
> @@ -496,14 +501,17 @@ void copy_id21_to_sam_passwd(const char *log_prefix,
>  
>  	if ((from->fields_present & SAMR_FIELD_PARAMETERS) &&
>  	    (from->parameters.array)) {
> -		char *newstr;
> +		char *newstr = NULL;
>  		DATA_BLOB mung;
>  		old_string = pdb_get_munged_dial(to);
>  
>  		mung = data_blob_const(from->parameters.array,
>  				       from->parameters.length);
> -		newstr = (mung.length == 0) ?
> -			NULL : base64_encode_data_blob(talloc_tos(), mung);
> +
> +		if (mung.length != 0) {
> +			newstr = base64_encode_data_blob(talloc_tos(), mung);
> +			SMB_ASSERT(newstr != NULL);
> +		}
>  		DEBUG(10,("%s SAMR_FIELD_PARAMETERS: %s -> %s\n", l,
>  			old_string, newstr));
>  		if (STRING_CHANGED_NC(old_string,newstr)) {
> diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
> index 1b27a88..7bce5ca 100644
> --- a/source3/utils/ntlm_auth.c
> +++ b/source3/utils/ntlm_auth.c
> @@ -1452,6 +1452,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
>  			return;
>  		} else {
>  			base64_key = base64_encode_data_blob(state, session_key);
> +			SMB_ASSERT(base64_key != NULL);
>  			x_fprintf(x_stdout, "GK %s\n", base64_key);
>  			talloc_free(base64_key);
>  		}
> @@ -1481,6 +1482,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
>  
>  	if (out.length) {
>  		out_base64 = base64_encode_data_blob(mem_ctx, out);
> +		SMB_ASSERT(out_base64 != NULL);
>  	} else {
>  		out_base64 = NULL;
>  	}
> diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c
> index 0816024..6d0e259 100644
> --- a/source4/utils/ntlm_auth.c
> +++ b/source4/utils/ntlm_auth.c
> @@ -621,6 +621,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
>  			return;
>  		} else {
>  			base64_key = base64_encode_data_blob(state, session_key);
> +			SMB_ASSERT(base64_key != NULL);
>  			mux_printf(mux_id, "GK %s\n", base64_key);
>  			talloc_free(base64_key);
>  		}
> @@ -648,6 +649,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
>  
>  	if (out.length) {
>  		out_base64 = base64_encode_data_blob(mem_ctx, out);
> +		SMB_ASSERT(out_base64 != NULL);
>  	} else {
>  		out_base64 = NULL;
>  	}
> -- 
> 1.9.1
> 
> 
> From d5a182f97114e0fc0e3e2a24cc25b7741c83fba3 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 3 May 2016 15:56:37 +0200
> Subject: [PATCH 4/6] lib: Remove SMB_ASSERT from base64_encode_data_blob
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  lib/util/base64.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/util/base64.c b/lib/util/base64.c
> index a4ce6fa..e01fb6d 100644
> --- a/lib/util/base64.c
> +++ b/lib/util/base64.c
> @@ -114,7 +114,9 @@ _PUBLIC_ char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data)
>  					   * random but should be enough for
>  					   * the = and \0 */
>  	result = talloc_array(mem_ctx, char, output_len); /* get us plenty of space */
> -	SMB_ASSERT(result != NULL);
> +	if (result == NULL) {
> +		return NULL;
> +	}
>  
>  	while (len--) {
>  		int c = (unsigned char) *(data.data++);
> -- 
> 1.9.1
> 
> 
> From f54f163af966e381f8b3785aae6ed9787a25b3f5 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 3 May 2016 16:12:10 +0200
> Subject: [PATCH 5/6] lib: Give base64.c its own .h
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  auth/gensec/gensec_start.c                  |  1 +
>  auth/gensec/spnego.c                        |  1 +
>  lib/util/base64.c                           |  1 +
>  lib/util/base64.h                           | 52 +++++++++++++++++++++++++++++
>  lib/util/charset/tests/convert_string.c     |  1 +
>  lib/util/samba_util.h                       | 21 ------------
>  source3/lib/tldap_util.c                    |  1 +
>  source3/libnet/libnet_dssync_passdb.c       |  1 +
>  source3/libnet/libnet_samsync_ldif.c        |  1 +
>  source3/libnet/libnet_samsync_passdb.c      |  1 +
>  source3/passdb/pdb_ipa.c                    |  1 +
>  source3/passdb/pdb_samba_dsdb.c             |  1 +
>  source3/rpc_server/samr/srv_samr_nt.c       |  1 +
>  source3/rpc_server/samr/srv_samr_util.c     |  1 +
>  source3/torture/torture.c                   |  1 +
>  source3/utils/ntlm_auth.c                   |  1 +
>  source4/lib/http/gensec/basic.c             |  1 +
>  source4/lib/http/gensec/ntlm.c              |  1 +
>  source4/ntvfs/posix/python/pyxattr_native.c |  1 +
>  source4/torture/ndr/drsblobs.c              |  1 +
>  source4/utils/ntlm_auth.c                   |  1 +
>  21 files changed, 71 insertions(+), 21 deletions(-)
>  create mode 100644 lib/util/base64.h
> 
> diff --git a/auth/gensec/gensec_start.c b/auth/gensec/gensec_start.c
> index 4c43519..1e61627 100644
> --- a/auth/gensec/gensec_start.c
> +++ b/auth/gensec/gensec_start.c
> @@ -31,6 +31,7 @@
>  #include "lib/param/param.h"
>  #include "lib/util/tsort.h"
>  #include "lib/util/samba_modules.h"
> +#include "lib/util/base64.h"
>  
>  /* the list of currently registered GENSEC backends */
>  static const struct gensec_security_ops **generic_security_ops;
> diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c
> index 3962d72..ef30ab7 100644
> --- a/auth/gensec/spnego.c
> +++ b/auth/gensec/spnego.c
> @@ -30,6 +30,7 @@
>  #include "auth/gensec/gensec_internal.h"
>  #include "param/param.h"
>  #include "lib/util/asn1.h"
> +#include "lib/util/base64.h"
>  
>  #undef strcasecmp
>  
> diff --git a/lib/util/base64.c b/lib/util/base64.c
> index e01fb6d..157cb34 100644
> --- a/lib/util/base64.c
> +++ b/lib/util/base64.c
> @@ -23,6 +23,7 @@
>  */
>  
>  #include "includes.h"
> +#include "lib/util/base64.h"
>  
>  static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
>  
> diff --git a/lib/util/base64.h b/lib/util/base64.h
> new file mode 100644
> index 0000000..4763804
> --- /dev/null
> +++ b/lib/util/base64.h
> @@ -0,0 +1,52 @@
> +/*
> + * Unix SMB/CIFS implementation.
> + * Samba utility functions
> + *
> + * Copyright (C) Andrew Tridgell 1992-2001
> + * Copyright (C) Simo Sorce      2001-2002
> + * Copyright (C) Martin Pool     2003
> + * Copyright (C) James Peach	 2006
> + * Copyright (C) Jeremy Allison  1992-2007
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 3 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef __LIB_UTIL_BASE64_H__
> +#define __LIB_UTIL_BASE64_H__
> +
> +#include "replace.h"
> +#include "lib/util/data_blob.h"
> +
> +/**
> + Base64 decode a string, place into a data blob.  Caller to
> + data_blob_free() the result.
> +**/
> +DATA_BLOB base64_decode_data_blob_talloc(TALLOC_CTX *mem_ctx, const char *s);
> +
> +/**
> + Base64 decode a string, place into a data blob on NULL context.
> + Caller to data_blob_free() the result.
> +**/
> +DATA_BLOB base64_decode_data_blob(const char *s);
> +
> +/**
> + Base64 decode a string, inplace
> +**/
> +void base64_decode_inplace(char *s);
> +/**
> + Base64 encode a binary data blob into a string
> +**/
> +char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
> +
> +#endif
> diff --git a/lib/util/charset/tests/convert_string.c b/lib/util/charset/tests/convert_string.c
> index 92de702..e63fca6 100644
> --- a/lib/util/charset/tests/convert_string.c
> +++ b/lib/util/charset/tests/convert_string.c
> @@ -22,6 +22,7 @@
>  #include "torture/torture.h"
>  #include "lib/util/charset/charset.h"
>  #include "param/param.h"
> +#include "lib/util/base64.h"
>  
>  struct torture_suite *torture_local_convert_string_handle(TALLOC_CTX *mem_ctx);
>  struct torture_suite *torture_local_string_case_handle(TALLOC_CTX *mem_ctx);
> diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
> index 387e957..c339161 100644
> --- a/lib/util/samba_util.h
> +++ b/lib/util/samba_util.h
> @@ -303,27 +303,6 @@ _PUBLIC_ int strwicmp(const char *psz1, const char *psz2);
>  _PUBLIC_ void string_replace(char *s, char oldc, char newc);
>  
>  /**
> - Base64 decode a string, place into a data blob.  Caller to data_blob_free() the result.
> -**/
> -_PUBLIC_ DATA_BLOB base64_decode_data_blob_talloc(TALLOC_CTX *mem_ctx, const char *s);
> -
> -/**
> - Base64 decode a string, place into a data blob on NULL context.
> - Caller to data_blob_free() the result.
> -**/
> -_PUBLIC_ DATA_BLOB base64_decode_data_blob(const char *s);
> -
> -
> -/**
> - Base64 decode a string, inplace
> -**/
> -_PUBLIC_ void base64_decode_inplace(char *s);
> -/**
> - Base64 encode a binary data blob into a string
> -**/
> -_PUBLIC_ char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
> -
> -/**
>   * Compare 2 strings.
>   *
>   * @note The comparison is case-insensitive.
> diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c
> index b7233f6..89f812b 100644
> --- a/source3/lib/tldap_util.c
> +++ b/source3/lib/tldap_util.c
> @@ -23,6 +23,7 @@
>  #include "../libcli/security/security.h"
>  #include "../lib/util/asn1.h"
>  #include "../librpc/ndr/libndr.h"
> +#include "lib/util/base64.h"
>  
>  bool tldap_entry_values(struct tldap_message *msg, const char *attribute,
>  			DATA_BLOB **values, int *num_values)
> diff --git a/source3/libnet/libnet_dssync_passdb.c b/source3/libnet/libnet_dssync_passdb.c
> index 62ce074..b80bece 100644
> --- a/source3/libnet/libnet_dssync_passdb.c
> +++ b/source3/libnet/libnet_dssync_passdb.c
> @@ -28,6 +28,7 @@
>  #include "dbwrap/dbwrap_rbt.h"
>  #include "../libds/common/flag_mapping.h"
>  #include "passdb.h"
> +#include "lib/util/base64.h"
>  
>  /****************************************************************
>  ****************************************************************/
> diff --git a/source3/libnet/libnet_samsync_ldif.c b/source3/libnet/libnet_samsync_ldif.c
> index d9ae414..198373e 100644
> --- a/source3/libnet/libnet_samsync_ldif.c
> +++ b/source3/libnet/libnet_samsync_ldif.c
> @@ -29,6 +29,7 @@
>  #include "transfer_file.h"
>  #include "passdb.h"
>  #include "passdb/pdb_ldap_schema.h"
> +#include "lib/util/base64.h"
>  
>  #ifdef HAVE_LDAP
>  
> diff --git a/source3/libnet/libnet_samsync_passdb.c b/source3/libnet/libnet_samsync_passdb.c
> index 5185722..91482e6 100644
> --- a/source3/libnet/libnet_samsync_passdb.c
> +++ b/source3/libnet/libnet_samsync_passdb.c
> @@ -28,6 +28,7 @@
>  #include "libnet/libnet_samsync.h"
>  #include "../libcli/security/security.h"
>  #include "passdb.h"
> +#include "lib/util/base64.h"
>  
>  /* Convert a struct samu_DELTA to a struct samu. */
>  #define STRING_CHANGED (old_string && !new_string) ||\
> diff --git a/source3/passdb/pdb_ipa.c b/source3/passdb/pdb_ipa.c
> index 4d9d09c..ca305aa 100644
> --- a/source3/passdb/pdb_ipa.c
> +++ b/source3/passdb/pdb_ipa.c
> @@ -29,6 +29,7 @@
>  #include "passdb/pdb_ldap.h"
>  #include "passdb/pdb_ipa.h"
>  #include "passdb/pdb_ldap_schema.h"
> +#include "lib/util/base64.h"
>  
>  #define IPA_KEYTAB_SET_OID "2.16.840.1.113730.3.8.3.1"
>  #define IPA_MAGIC_ID_STR "999"
> diff --git a/source3/passdb/pdb_samba_dsdb.c b/source3/passdb/pdb_samba_dsdb.c
> index 54b9ef9..56f3f10 100644
> --- a/source3/passdb/pdb_samba_dsdb.c
> +++ b/source3/passdb/pdb_samba_dsdb.c
> @@ -39,6 +39,7 @@
>  #include "source3/include/secrets.h"
>  #include "source4/auth/auth_sam.h"
>  #include "auth/credentials/credentials.h"
> +#include "lib/util/base64.h"
>  
>  struct pdb_samba_dsdb_state {
>  	struct tevent_context *ev;
> diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c
> index 2f6f020..6354556 100644
> --- a/source3/rpc_server/samr/srv_samr_nt.c
> +++ b/source3/rpc_server/samr/srv_samr_nt.c
> @@ -45,6 +45,7 @@
>  #include "auth.h"
>  #include "rpc_server/srv_access_check.h"
>  #include "../lib/tsocket/tsocket.h"
> +#include "lib/util/base64.h"
>  
>  #undef DBGC_CLASS
>  #define DBGC_CLASS DBGC_RPC_SRV
> diff --git a/source3/rpc_server/samr/srv_samr_util.c b/source3/rpc_server/samr/srv_samr_util.c
> index 4c2307d..e48c020 100644
> --- a/source3/rpc_server/samr/srv_samr_util.c
> +++ b/source3/rpc_server/samr/srv_samr_util.c
> @@ -26,6 +26,7 @@
>  #include "../librpc/gen_ndr/samr.h"
>  #include "rpc_server/samr/srv_samr_util.h"
>  #include "passdb.h"
> +#include "lib/util/base64.h"
>  
>  #undef DBGC_CLASS
>  #define DBGC_CLASS DBGC_RPC_SRV
> diff --git a/source3/torture/torture.c b/source3/torture/torture.c
> index 8b8dbe9..d6489c8 100644
> --- a/source3/torture/torture.c
> +++ b/source3/torture/torture.c
> @@ -42,6 +42,7 @@
>  #include "../libcli/smb/read_smb.h"
>  #include "../libcli/smb/smbXcli_base.h"
>  #include "lib/util/sys_rw_data.h"
> +#include "lib/util/base64.h"
>  
>  extern char *optarg;
>  extern int optind;
> diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
> index 7bce5ca..e19bc7e 100644
> --- a/source3/utils/ntlm_auth.c
> +++ b/source3/utils/ntlm_auth.c
> @@ -45,6 +45,7 @@
>  #include "source3/auth/proto.h"
>  #include "nsswitch/libwbclient/wbclient.h"
>  #include "lib/param/loadparm.h"
> +#include "lib/util/base64.h"
>  
>  #if HAVE_KRB5
>  #include "auth/kerberos/pac_utils.h"
> diff --git a/source4/lib/http/gensec/basic.c b/source4/lib/http/gensec/basic.c
> index 86a2d51..4a488a3 100644
> --- a/source4/lib/http/gensec/basic.c
> +++ b/source4/lib/http/gensec/basic.c
> @@ -24,6 +24,7 @@
>  #include "auth/gensec/gensec.h"
>  #include "auth/gensec/gensec_internal.h"
>  #include "auth/credentials/credentials.h"
> +#include "lib/util/base64.h"
>  
>  _PUBLIC_ NTSTATUS gensec_http_basic_init(void);
>  
> diff --git a/source4/lib/http/gensec/ntlm.c b/source4/lib/http/gensec/ntlm.c
> index 07470fa..8afb275 100644
> --- a/source4/lib/http/gensec/ntlm.c
> +++ b/source4/lib/http/gensec/ntlm.c
> @@ -23,6 +23,7 @@
>  #include "auth/auth.h"
>  #include "auth/gensec/gensec.h"
>  #include "auth/gensec/gensec_internal.h"
> +#include "lib/util/base64.h"
>  
>  _PUBLIC_ NTSTATUS gensec_http_ntlm_init(void);
>  
> diff --git a/source4/ntvfs/posix/python/pyxattr_native.c b/source4/ntvfs/posix/python/pyxattr_native.c
> index 8dd98d2..6758996 100644
> --- a/source4/ntvfs/posix/python/pyxattr_native.c
> +++ b/source4/ntvfs/posix/python/pyxattr_native.c
> @@ -22,6 +22,7 @@
>  #include "includes.h"
>  #include "librpc/ndr/libndr.h"
>  #include "system/filesys.h"
> +#include "lib/util/base64.h"
>  
>  void initxattr_native(void);
>  
> diff --git a/source4/torture/ndr/drsblobs.c b/source4/torture/ndr/drsblobs.c
> index 938b6fe..ecdc014 100644
> --- a/source4/torture/ndr/drsblobs.c
> +++ b/source4/torture/ndr/drsblobs.c
> @@ -22,6 +22,7 @@
>  #include "torture/ndr/ndr.h"
>  #include "librpc/gen_ndr/ndr_drsblobs.h"
>  #include "torture/ndr/proto.h"
> +#include "lib/util/base64.h"
>  
>  static const uint8_t forest_trust_info_data_out[] = {
>  	0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
> diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c
> index 6d0e259..75dcebf 100644
> --- a/source4/utils/ntlm_auth.c
> +++ b/source4/utils/ntlm_auth.c
> @@ -38,6 +38,7 @@
>  #include "lib/messaging/irpc.h"
>  #include "auth/ntlmssp/ntlmssp.h"
>  #include "param/param.h"
> +#include "lib/util/base64.h"
>  
>  #define INITIAL_BUFFER_SIZE 300
>  #define MAX_BUFFER_SIZE 63000
> -- 
> 1.9.1
> 
> 
> From d19855a7090443839fd4f624a8a4d22cae9de586 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 3 May 2016 16:12:23 +0200
> Subject: [PATCH 6/6] lib: Avoid includes.h in base64.c
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  lib/util/base64.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/util/base64.c b/lib/util/base64.c
> index 157cb34..e9906f1 100644
> --- a/lib/util/base64.c
> +++ b/lib/util/base64.c
> @@ -22,7 +22,7 @@
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  */
>  
> -#include "includes.h"
> +#include "replace.h"
>  #include "lib/util/base64.h"
>  
>  static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
> -- 
> 1.9.1
> 




More information about the samba-technical mailing list