Hi!

Compiling samba CVS with gcc 3.3 gives quite some 
annoying warnings in proto.h because exp and log are
builtins. Attached is a patch that replaces exp with expr
and log with clog (didn't know a better name for it)
in the affected c files.

Please apply.

Greetings, Stephan
Index: rpc_parse/parse_misc.c
===================================================================
RCS file: /cvsroot/samba/source/rpc_parse/parse_misc.c,v
retrieving revision 1.111
diff -u -3 -p -u -r1.111 parse_misc.c
--- rpc_parse/parse_misc.c	15 Mar 2003 07:45:51 -0000	1.111
+++ rpc_parse/parse_misc.c	25 Mar 2003 09:05:39 -0000
@@ -1289,22 +1289,22 @@ void init_dom_rid4(DOM_RID4 *rid4, uint1
  Inits a DOM_CLNT_SRV structure.
 ********************************************************************/
 
-static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char *comp_name)
+static void init_clnt_srv(DOM_CLNT_SRV *clog, const char *logon_srv, const char *comp_name)
 {
 	DEBUG(5,("init_clnt_srv: %d\n", __LINE__));
 
 	if (logon_srv != NULL) {
-		log->undoc_buffer = 1;
-		init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1);
+		clog->undoc_buffer = 1;
+		init_unistr2(&clog->uni_logon_srv, logon_srv, strlen(logon_srv)+1);
 	} else {
-		log->undoc_buffer = 0;
+		clog->undoc_buffer = 0;
 	}
 
 	if (comp_name != NULL) {
-		log->undoc_buffer2 = 1;
-		init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1);
+		clog->undoc_buffer2 = 1;
+		init_unistr2(&clog->uni_comp_name, comp_name, strlen(comp_name)+1);
 	} else {
-		log->undoc_buffer2 = 0;
+		clog->undoc_buffer2 = 0;
 	}
 }
 
@@ -1312,9 +1312,9 @@ static void init_clnt_srv(DOM_CLNT_SRV *
  Inits or writes a DOM_CLNT_SRV structure.
 ********************************************************************/
 
-static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth)
+static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *clog, prs_struct *ps, int depth)
 {
-	if (log == NULL)
+	if (clog == NULL)
 		return False;
 
 	prs_debug(ps, depth, desc, "smb_io_clnt_srv");
@@ -1323,22 +1323,22 @@ static BOOL smb_io_clnt_srv(const char *
 	if(!prs_align(ps))
 		return False;
 	
-	if(!prs_uint32("undoc_buffer ", ps, depth, &log->undoc_buffer))
+	if(!prs_uint32("undoc_buffer ", ps, depth, &clog->undoc_buffer))
 		return False;
 
-	if (log->undoc_buffer != 0) {
-		if(!smb_io_unistr2("unistr2", &log->uni_logon_srv, log->undoc_buffer, ps, depth))
+	if (clog->undoc_buffer != 0) {
+		if(!smb_io_unistr2("unistr2", &clog->uni_logon_srv, clog->undoc_buffer, ps, depth))
 			return False;
 	}
 
 	if(!prs_align(ps))
 		return False;
 
-	if(!prs_uint32("undoc_buffer2", ps, depth, &log->undoc_buffer2))
+	if(!prs_uint32("undoc_buffer2", ps, depth, &clog->undoc_buffer2))
 		return False;
 
-	if (log->undoc_buffer2 != 0) {
-		if(!smb_io_unistr2("unistr2", &log->uni_comp_name, log->undoc_buffer2, ps, depth))
+	if (clog->undoc_buffer2 != 0) {
+		if(!smb_io_unistr2("unistr2", &clog->uni_comp_name, clog->undoc_buffer2, ps, depth))
 			return False;
 	}
 
@@ -1349,28 +1349,28 @@ static BOOL smb_io_clnt_srv(const char *
  Inits a DOM_LOG_INFO structure.
 ********************************************************************/
 
-void init_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_name,
+void init_log_info(DOM_LOG_INFO *clog, const char *logon_srv, const char *acct_name,
 		uint16 sec_chan, const char *comp_name)
 {
 	DEBUG(5,("make_log_info %d\n", __LINE__));
 
-	log->undoc_buffer = 1;
+	clog->undoc_buffer = 1;
 
-	init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1);
-	init_unistr2(&log->uni_acct_name, acct_name, strlen(acct_name)+1);
+	init_unistr2(&clog->uni_logon_srv, logon_srv, strlen(logon_srv)+1);
+	init_unistr2(&clog->uni_acct_name, acct_name, strlen(acct_name)+1);
 
-	log->sec_chan = sec_chan;
+	clog->sec_chan = sec_chan;
 
-	init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1);
+	init_unistr2(&clog->uni_comp_name, comp_name, strlen(comp_name)+1);
 }
 
 /*******************************************************************
  Reads or writes a DOM_LOG_INFO structure.
 ********************************************************************/
 
-BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth)
+BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *clog, prs_struct *ps, int depth)
 {
-	if (log == NULL)
+	if (clog == NULL)
 		return False;
 
 	prs_debug(ps, depth, desc, "smb_io_log_info");
@@ -1379,18 +1379,18 @@ BOOL smb_io_log_info(const char *desc, D
 	if(!prs_align(ps))
 		return False;
 	
-	if(!prs_uint32("undoc_buffer", ps, depth, &log->undoc_buffer))
+	if(!prs_uint32("undoc_buffer", ps, depth, &clog->undoc_buffer))
 		return False;
 
-	if(!smb_io_unistr2("unistr2", &log->uni_logon_srv, True, ps, depth))
+	if(!smb_io_unistr2("unistr2", &clog->uni_logon_srv, True, ps, depth))
 		return False;
-	if(!smb_io_unistr2("unistr2", &log->uni_acct_name, True, ps, depth))
+	if(!smb_io_unistr2("unistr2", &clog->uni_acct_name, True, ps, depth))
 		return False;
 
-	if(!prs_uint16("sec_chan", ps, depth, &log->sec_chan))
+	if(!prs_uint16("sec_chan", ps, depth, &clog->sec_chan))
 		return False;
 
-	if(!smb_io_unistr2("unistr2", &log->uni_comp_name, True, ps, depth))
+	if(!smb_io_unistr2("unistr2", &clog->uni_comp_name, True, ps, depth))
 		return False;
 
 	return True;
@@ -1529,21 +1529,21 @@ BOOL smb_io_clnt_info(const char *desc, 
  Inits a DOM_LOGON_ID structure.
 ********************************************************************/
 
-void init_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high)
+void init_logon_id(DOM_LOGON_ID *clog, uint32 log_id_low, uint32 log_id_high)
 {
 	DEBUG(5,("make_logon_id: %d\n", __LINE__));
 
-	log->low  = log_id_low;
-	log->high = log_id_high;
+	clog->low  = log_id_low;
+	clog->high = log_id_high;
 }
 
 /*******************************************************************
  Reads or writes a DOM_LOGON_ID structure.
 ********************************************************************/
 
-BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth)
+BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *clog, prs_struct *ps, int depth)
 {
-	if (log == NULL)
+	if (clog == NULL)
 		return False;
 
 	prs_debug(ps, depth, desc, "smb_io_logon_id");
@@ -1552,9 +1552,9 @@ BOOL smb_io_logon_id(const char *desc, D
 	if(!prs_align(ps))
 		return False;
 	
-	if(!prs_uint32("low ", ps, depth, &log->low ))
+	if(!prs_uint32("low ", ps, depth, &clog->low ))
 		return False;
-	if(!prs_uint32("high", ps, depth, &log->high))
+	if(!prs_uint32("high", ps, depth, &clog->high))
 		return False;
 
 	return True;
Index: libads/ldap.c
===================================================================
RCS file: /cvsroot/samba/source/libads/ldap.c,v
retrieving revision 1.103
diff -u -3 -p -u -r1.103 ldap.c
--- libads/ldap.c	25 Feb 2003 02:23:19 -0000	1.103
+++ libads/ldap.c	25 Mar 2003 09:05:39 -0000
@@ -401,7 +401,7 @@ static char **ads_pull_strvals(TALLOC_CT
  * @param ads connection to ads server 
  * @param bind_path Base dn for the search
  * @param scope Scope of search (LDAP_BASE | LDAP_ONE | LDAP_SUBTREE)
- * @param exp Search expression - specified in local charset
+ * @param expr Search expression - specified in local charset
  * @param attrs Attributes to retrieve - specified in utf8 or ascii
  * @param res ** which will contain results - free res* with ads_msgfree()
  * @param count Number of entries retrieved on this page
@@ -409,12 +409,12 @@ static char **ads_pull_strvals(TALLOC_CT
  * @return status of search
  **/
 ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path,
-			       int scope, const char *exp,
+			       int scope, const char *expr,
 			       const char **attrs, void **res, 
 			       int *count, void **cookie)
 {
 	int rc, i, version;
-	char *utf8_exp, *utf8_path, **search_attrs;
+	char *utf8_expr, *utf8_path, **search_attrs;
 	LDAPControl PagedResults, NoReferrals, *controls[3], **rcontrols; 
 	BerElement *cookie_be = NULL;
 	struct berval *cookie_bv= NULL;
@@ -428,7 +428,7 @@ ADS_STATUS ads_do_paged_search(ADS_STRUC
 	/* 0 means the conversion worked but the result was empty 
 	   so we only fail if it's -1.  In any case, it always 
 	   at least nulls out the dest */
-	if ((push_utf8_talloc(ctx, &utf8_exp, exp) == (size_t)-1) ||
+	if ((push_utf8_talloc(ctx, &utf8_expr, expr) == (size_t)-1) ||
 	    (push_utf8_talloc(ctx, &utf8_path, bind_path) == (size_t)-1)) {
 		rc = LDAP_NO_MEMORY;
 		goto done;
@@ -489,7 +489,7 @@ ADS_STATUS ads_do_paged_search(ADS_STRUC
 	*/
 	ldap_set_option(ads->ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
 
-	rc = ldap_search_ext_s(ads->ld, utf8_path, scope, utf8_exp, 
+	rc = ldap_search_ext_s(ads->ld, utf8_path, scope, utf8_expr, 
 			       search_attrs, 0, controls,
 			       NULL, NULL, LDAP_NO_LIMIT, (LDAPMessage **)res);
 
@@ -497,7 +497,7 @@ ADS_STATUS ads_do_paged_search(ADS_STRUC
 	ber_bvfree(cookie_bv);
 
 	if (rc) {
-		DEBUG(3,("ldap_search_ext_s(%s) -> %s\n", exp, ldap_err2string(rc)));
+		DEBUG(3,("ldap_search_ext_s(%s) -> %s\n", expr, ldap_err2string(rc)));
 		goto done;
 	}
 
@@ -541,20 +541,20 @@ done:
  * @param ads connection to ads server 
  * @param bind_path Base dn for the search
  * @param scope Scope of search (LDAP_BASE | LDAP_ONE | LDAP_SUBTREE)
- * @param exp Search expression
+ * @param expr Search expression
  * @param attrs Attributes to retrieve
  * @param res ** which will contain results - free res* with ads_msgfree()
  * @return status of search
  **/
 ADS_STATUS ads_do_search_all(ADS_STRUCT *ads, const char *bind_path,
-			     int scope, const char *exp,
+			     int scope, const char *expr,
 			     const char **attrs, void **res)
 {
 	void *cookie = NULL;
 	int count = 0;
 	ADS_STATUS status;
 
-	status = ads_do_paged_search(ads, bind_path, scope, exp, attrs, res,
+	status = ads_do_paged_search(ads, bind_path, scope, expr, attrs, res,
 				     &count, &cookie);
 
 	if (!ADS_ERR_OK(status)) return status;
@@ -564,7 +564,7 @@ ADS_STATUS ads_do_search_all(ADS_STRUCT 
 		ADS_STATUS status2;
 		LDAPMessage *msg, *next;
 
-		status2 = ads_do_paged_search(ads, bind_path, scope, exp, 
+		status2 = ads_do_paged_search(ads, bind_path, scope, expr, 
 					      attrs, &res2, &count, &cookie);
 
 		if (!ADS_ERR_OK(status2)) break;
@@ -588,14 +588,14 @@ ADS_STATUS ads_do_search_all(ADS_STRUCT 
  * @param ads connection to ads server
  * @param bind_path Base dn for the search
  * @param scope Scope of search (LDAP_BASE | LDAP_ONE | LDAP_SUBTREE)
- * @param exp Search expression - specified in local charset
+ * @param expr Search expression - specified in local charset
  * @param attrs Attributes to retrieve - specified in UTF-8 or ascii
  * @param fn Function which takes attr name, values list, and data_area
  * @param data_area Pointer which is passed to function on each call
  * @return status of search
  **/
 ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
-				int scope, const char *exp, const char **attrs,
+				int scope, const char *expr, const char **attrs,
 				BOOL(*fn)(char *, void **, void *), 
 				void *data_area)
 {
@@ -604,7 +604,7 @@ ADS_STATUS ads_do_search_all_fn(ADS_STRU
 	ADS_STATUS status;
 	void *res;
 
-	status = ads_do_paged_search(ads, bind_path, scope, exp, attrs, &res,
+	status = ads_do_paged_search(ads, bind_path, scope, expr, attrs, &res,
 				     &count, &cookie);
 
 	if (!ADS_ERR_OK(status)) return status;
@@ -613,7 +613,7 @@ ADS_STATUS ads_do_search_all_fn(ADS_STRU
 	ads_msgfree(ads, res);
 
 	while (cookie) {
-		status = ads_do_paged_search(ads, bind_path, scope, exp, attrs,
+		status = ads_do_paged_search(ads, bind_path, scope, expr, attrs,
 					     &res, &count, &cookie);
 
 		if (!ADS_ERR_OK(status)) break;
@@ -630,18 +630,18 @@ ADS_STATUS ads_do_search_all_fn(ADS_STRU
  * @param ads connection to ads server
  * @param bind_path Base dn for the search
  * @param scope Scope of search (LDAP_BASE | LDAP_ONE | LDAP_SUBTREE)
- * @param exp Search expression
+ * @param expr Search expression
  * @param attrs Attributes to retrieve
  * @param res ** which will contain results - free res* with ads_msgfree()
  * @return status of search
  **/
 ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope, 
-			 const char *exp,
+			 const char *expr,
 			 const char **attrs, void **res)
 {
 	struct timeval timeout;
 	int rc;
-	char *utf8_exp, *utf8_path, **search_attrs = NULL;
+	char *utf8_expr, *utf8_path, **search_attrs = NULL;
 	TALLOC_CTX *ctx;
 
 	if (!(ctx = talloc_init("ads_do_search"))) {
@@ -652,7 +652,7 @@ ADS_STATUS ads_do_search(ADS_STRUCT *ads
 	/* 0 means the conversion worked but the result was empty 
 	   so we only fail if it's negative.  In any case, it always 
 	   at least nulls out the dest */
-	if ((push_utf8_talloc(ctx, &utf8_exp, exp) == (size_t)-1) ||
+	if ((push_utf8_talloc(ctx, &utf8_expr, expr) == (size_t)-1) ||
 	    (push_utf8_talloc(ctx, &utf8_path, bind_path) == (size_t)-1)) {
 		DEBUG(1,("ads_do_search: push_utf8_talloc() failed!"));
 		rc = LDAP_NO_MEMORY;
@@ -679,7 +679,7 @@ ADS_STATUS ads_do_search(ADS_STRUCT *ads
 	/* see the note in ads_do_paged_search - we *must* disable referrals */
 	ldap_set_option(ads->ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
 
-	rc = ldap_search_ext_s(ads->ld, utf8_path, scope, utf8_exp,
+	rc = ldap_search_ext_s(ads->ld, utf8_path, scope, utf8_expr,
 			       search_attrs, 0, NULL, NULL, 
 			       &timeout, LDAP_NO_LIMIT, (LDAPMessage **)res);
 
@@ -698,16 +698,16 @@ ADS_STATUS ads_do_search(ADS_STRUCT *ads
  * Do a general ADS search
  * @param ads connection to ads server
  * @param res ** which will contain results - free res* with ads_msgfree()
- * @param exp Search expression
+ * @param expr Search expression
  * @param attrs Attributes to retrieve
  * @return status of search
  **/
 ADS_STATUS ads_search(ADS_STRUCT *ads, void **res, 
-		      const char *exp, 
+		      const char *expr, 
 		      const char **attrs)
 {
 	return ads_do_search(ads, ads->config.bind_path, LDAP_SCOPE_SUBTREE, 
-			     exp, attrs, res);
+			     expr, attrs, res);
 }
 
 /**
@@ -772,18 +772,18 @@ char *ads_get_dn(ADS_STRUCT *ads, void *
 ADS_STATUS ads_find_machine_acct(ADS_STRUCT *ads, void **res, const char *host)
 {
 	ADS_STATUS status;
-	char *exp;
+	char *expr;
 	const char *attrs[] = {"*", "nTSecurityDescriptor", NULL};
 
 	/* the easiest way to find a machine account anywhere in the tree
 	   is to look for hostname$ */
-	if (asprintf(&exp, "(samAccountName=%s$)", host) == -1) {
+	if (asprintf(&expr, "(samAccountName=%s$)", host) == -1) {
 		DEBUG(1, ("asprintf failed!\n"));
 		return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
 	}
 	
-	status = ads_search(ads, res, exp, attrs);
-	free(exp);
+	status = ads_search(ads, res, expr, attrs);
+	free(expr);
 	return status;
 }
 
@@ -1424,7 +1424,7 @@ ADS_STATUS ads_leave_realm(ADS_STRUCT *a
 ADS_STATUS ads_set_machine_sd(ADS_STRUCT *ads, const char *hostname, char *dn)
 {
 	const char     *attrs[] = {"nTSecurityDescriptor", "objectSid", 0};
-	char           *exp     = 0;
+	char           *expr     = 0;
 	size_t          sd_size = 0;
 	struct berval   bval = {0, NULL};
 	prs_struct      ps_wire;
@@ -1452,7 +1452,7 @@ ADS_STATUS ads_set_machine_sd(ADS_STRUCT
 		return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
 	}
 
-	if (asprintf(&exp, "(samAccountName=%s$)", escaped_hostname) == -1) {
+	if (asprintf(&expr, "(samAccountName=%s$)", escaped_hostname) == -1) {
 		DEBUG(1, ("ads_set_machine_sd: asprintf failed!\n"));
 		SAFE_FREE(escaped_hostname);
 		return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
@@ -1460,7 +1460,7 @@ ADS_STATUS ads_set_machine_sd(ADS_STRUCT
 
 	SAFE_FREE(escaped_hostname);
 
-	ret = ads_search(ads, (void *) &res, exp, attrs);
+	ret = ads_search(ads, (void *) &res, expr, attrs);
 
 	if (!ADS_ERR_OK(ret)) return ret;
 
@@ -2036,7 +2036,7 @@ but you need to force the bind path to m
 */
 ADS_STATUS ads_workgroup_name(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **workgroup)
 {
-	char *exp;
+	char *expr;
 	ADS_STATUS rc;
 	char **principles;
 	char *prefix;
@@ -2047,10 +2047,10 @@ ADS_STATUS ads_workgroup_name(ADS_STRUCT
 
 	(*workgroup) = NULL;
 
-	asprintf(&exp, "(&(objectclass=computer)(dnshostname=%s.%s))", 
+	asprintf(&expr, "(&(objectclass=computer)(dnshostname=%s.%s))", 
 		 ads->config.ldap_server_name, ads->config.realm);
-	rc = ads_search(ads, &res, exp, attrs);
-	free(exp);
+	rc = ads_search(ads, &res, expr, attrs);
+	free(expr);
 
 	if (!ADS_ERR_OK(rc)) {
 		return rc;
Index: libads/ldap_utils.c
===================================================================
RCS file: /cvsroot/samba/source/libads/ldap_utils.c,v
retrieving revision 1.3
diff -u -3 -p -u -r1.3 ldap_utils.c
--- libads/ldap_utils.c	28 Sep 2002 12:27:04 -0000	1.3
+++ libads/ldap_utils.c	25 Mar 2003 09:05:39 -0000
@@ -28,7 +28,7 @@
   this is supposed to catch dropped connections and auto-reconnect
 */
 ADS_STATUS ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path, int scope, 
-			       const char *exp,
+			       const char *expr,
 			       const char **attrs, void **res)
 {
 	ADS_STATUS status;
@@ -46,10 +46,10 @@ ADS_STATUS ads_do_search_retry(ADS_STRUC
 		return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
 
 	while (count--) {
-		status = ads_do_search_all(ads, bp, scope, exp, attrs, res);
+		status = ads_do_search_all(ads, bp, scope, expr, attrs, res);
 		if (ADS_ERR_OK(status)) {
 			DEBUG(5,("Search for %s gave %d replies\n",
-				 exp, ads_count_replies(ads, *res)));
+				 expr, ads_count_replies(ads, *res)));
 			free(bp);
 			return status;
 		}
@@ -79,11 +79,11 @@ ADS_STATUS ads_do_search_retry(ADS_STRUC
 
 
 ADS_STATUS ads_search_retry(ADS_STRUCT *ads, void **res, 
-			    const char *exp, 
+			    const char *expr, 
 			    const char **attrs)
 {
 	return ads_do_search_retry(ads, ads->config.bind_path, LDAP_SCOPE_SUBTREE,
-				   exp, attrs, res);
+				   expr, attrs, res);
 }
 
 ADS_STATUS ads_search_retry_dn(ADS_STRUCT *ads, void **res, 

Reply via email to