svn commit: samba r16881 - in trunk/source/passdb: .

vlendec at samba.org vlendec at samba.org
Sat Jul 8 19:01:11 GMT 2006


Author: vlendec
Date: 2006-07-08 19:01:10 +0000 (Sat, 08 Jul 2006)
New Revision: 16881

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16881

Log:
Some C++ warnings
Modified:
   trunk/source/passdb/login_cache.c
   trunk/source/passdb/passdb.c
   trunk/source/passdb/pdb_get_set.c
   trunk/source/passdb/pdb_ldap.c
   trunk/source/passdb/pdb_nds.c
   trunk/source/passdb/pdb_smbpasswd.c
   trunk/source/passdb/pdb_tdb.c
   trunk/source/passdb/secrets.c


Changeset:
Modified: trunk/source/passdb/login_cache.c
===================================================================
--- trunk/source/passdb/login_cache.c	2006-07-08 17:37:13 UTC (rev 16880)
+++ trunk/source/passdb/login_cache.c	2006-07-08 19:01:10 UTC (rev 16881)
@@ -140,7 +140,7 @@
 			 entry.acct_ctrl,
 			 entry.bad_password_count,
 			 entry.bad_password_time);
-	databuf.dptr = SMB_MALLOC(databuf.dsize);
+	databuf.dptr = SMB_MALLOC_ARRAY(char, databuf.dsize);
 	if (!databuf.dptr) {
 		SAFE_FREE(keybuf.dptr);
 		return False;

Modified: trunk/source/passdb/passdb.c
===================================================================
--- trunk/source/passdb/passdb.c	2006-07-08 17:37:13 UTC (rev 16880)
+++ trunk/source/passdb/passdb.c	2006-07-08 19:01:10 UTC (rev 16881)
@@ -52,7 +52,7 @@
 
 static int samu_destroy(void *p) 
 {
-	struct samu *user = p;
+	struct samu *user = (struct samu *)p;
 
 	data_blob_clear_free( &user->lm_pw );
 	data_blob_clear_free( &user->nt_pw );
@@ -992,7 +992,7 @@
 
 	pdb_get_account_policy(AP_PASSWORD_HISTORY, &pwHistLen);
 	if (pwHistLen) {
-		uint8 *pw_hist = SMB_MALLOC(pwHistLen * PW_HISTORY_ENTRY_LEN);
+		uint8 *pw_hist = (uint8 *)SMB_MALLOC(pwHistLen * PW_HISTORY_ENTRY_LEN);
 		if (!pw_hist) {
 			ret = False;
 			goto done;

Modified: trunk/source/passdb/pdb_get_set.c
===================================================================
--- trunk/source/passdb/pdb_get_set.c	2006-07-08 17:37:13 UTC (rev 16880)
+++ trunk/source/passdb/pdb_get_set.c	2006-07-08 19:01:10 UTC (rev 16881)
@@ -1020,7 +1020,7 @@
 
 				if (current_history_len < pwHistLen) {
 					/* Ensure we have space for the needed history. */
-					uchar *new_history = TALLOC(sampass,
+					uchar *new_history = (uchar *)TALLOC(sampass,
 								pwHistLen*PW_HISTORY_ENTRY_LEN);
 					if (!new_history) {
 						return False;

Modified: trunk/source/passdb/pdb_ldap.c
===================================================================
--- trunk/source/passdb/pdb_ldap.c	2006-07-08 17:37:13 UTC (rev 16880)
+++ trunk/source/passdb/pdb_ldap.c	2006-07-08 19:01:10 UTC (rev 16881)
@@ -790,7 +790,7 @@
 
 		pwHistLen = MIN(pwHistLen, MAX_PW_HISTORY_LEN);
 
-		if ((pwhist = SMB_MALLOC(pwHistLen * PW_HISTORY_ENTRY_LEN)) == NULL){
+		if ((pwhist = SMB_MALLOC_ARRAY(uint8, pwHistLen * PW_HISTORY_ENTRY_LEN)) == NULL){
 			DEBUG(0, ("init_sam_from_ldap: malloc failed!\n"));
 			return False;
 		}
@@ -1748,7 +1748,7 @@
 	LDAPMod **mods = NULL;
 	const char **attr_list;
 
-	result = pdb_get_backend_private_data(newpwd, my_methods);
+	result = (LDAPMessage *)pdb_get_backend_private_data(newpwd, my_methods);
 	if (!result) {
 		attr_list = get_userattr_list(NULL, ldap_state->schema_ver);
 		if (pdb_get_username(newpwd) == NULL) {
@@ -3924,7 +3924,8 @@
 
 static BOOL ldapsam_search_firstpage(struct pdb_search *search)
 {
-	struct ldap_search_state *state = search->private_data;
+	struct ldap_search_state *state =
+		(struct ldap_search_state *)search->private_data;
 	LDAP *ld;
 	int rc = LDAP_OPERATIONS_ERROR;
 
@@ -3976,7 +3977,8 @@
 
 static BOOL ldapsam_search_nextpage(struct pdb_search *search)
 {
-	struct ldap_search_state *state = search->private_data;
+	struct ldap_search_state *state =
+		(struct ldap_search_state *)search->private_data;
 	int rc;
 
 	if (!state->connection->paged_results) {
@@ -4006,7 +4008,8 @@
 static BOOL ldapsam_search_next_entry(struct pdb_search *search,
 				      struct samr_displayentry *entry)
 {
-	struct ldap_search_state *state = search->private_data;
+	struct ldap_search_state *state =
+		(struct ldap_search_state *)search->private_data;
 	BOOL result;
 
  retry:
@@ -4041,7 +4044,8 @@
 
 static void ldapsam_search_end(struct pdb_search *search)
 {
-	struct ldap_search_state *state = search->private_data;
+	struct ldap_search_state *state =
+		(struct ldap_search_state *)search->private_data;
 	int rc;
 
 	if (state->pagedresults_cookie == NULL)
@@ -4157,7 +4161,8 @@
 				 struct pdb_search *search,
 				 uint32 acct_flags)
 {
-	struct ldapsam_privates *ldap_state = methods->private_data;
+	struct ldapsam_privates *ldap_state =
+		(struct ldapsam_privates *)methods->private_data;
 	struct ldap_search_state *state;
 
 	state = TALLOC_P(search->mem_ctx, struct ldap_search_state);
@@ -4315,7 +4320,8 @@
                                      const DOM_SID *sid,
 				     enum SID_NAME_USE type)
 {
-	struct ldapsam_privates *ldap_state = methods->private_data;
+	struct ldapsam_privates *ldap_state =
+		(struct ldapsam_privates *)methods->private_data;
 	struct ldap_search_state *state;
 
 	state = TALLOC_P(search->mem_ctx, struct ldap_search_state);
@@ -4474,8 +4480,8 @@
 	int i;
 
 	for (i=0; i<10; i++) {
-		NTSTATUS result = ldapsam_get_new_rid(methods->private_data,
-						      rid);
+		NTSTATUS result = ldapsam_get_new_rid(
+			(struct ldapsam_privates *)methods->private_data, rid);
 		if (NT_STATUS_IS_OK(result)) {
 			return result;
 		}
@@ -4501,7 +4507,8 @@
 			      const DOM_SID *sid,
 			      union unid_t *id, enum SID_NAME_USE *type)
 {
-	struct ldapsam_privates *priv = methods->private_data;
+	struct ldapsam_privates *priv =
+		(struct ldapsam_privates *)methods->private_data;
 	char *filter;
 	const char *attrs[] = { "sambaGroupType", "gidNumber", "uidNumber",
 				NULL };
@@ -5488,7 +5495,7 @@
 
 	(*pdb_method)->name = "ldapsam_compat";
 
-	ldap_state = (*pdb_method)->private_data;
+	ldap_state = (struct ldapsam_privates *)((*pdb_method)->private_data);
 	ldap_state->schema_ver = SCHEMAVER_SAMBAACCOUNT;
 
 	sid_copy(&ldap_state->domain_sid, get_global_sam_sid());
@@ -5546,7 +5553,7 @@
 		}
 	}
 
-	ldap_state = (*pdb_method)->private_data;
+	ldap_state = (struct ldapsam_privates *)((*pdb_method)->private_data);
 	ldap_state->schema_ver = SCHEMAVER_SAMBASAMACCOUNT;
 
 	/* Try to setup the Domain Name, Domain SID, algorithmic rid base */

Modified: trunk/source/passdb/pdb_nds.c
===================================================================
--- trunk/source/passdb/pdb_nds.c	2006-07-08 17:37:13 UTC (rev 16880)
+++ trunk/source/passdb/pdb_nds.c	2006-07-08 19:01:10 UTC (rev 16881)
@@ -241,7 +241,7 @@
 	if(retData)
 	{
 		retOctStrLen = *retDataLen + 1;
-		retOctStr = SMB_MALLOC(retOctStrLen);
+		retOctStr = SMB_MALLOC_ARRAY(char, retOctStrLen);
 		if(!retOctStr)
 		{
 			err = LDAP_OPERATIONS_ERROR;
@@ -404,7 +404,7 @@
 	size_t  pwdBufLen, bufferLen;
 
 	bufferLen = pwdBufLen = pwdLen+2;
-	pwdBuf = SMB_MALLOC(pwdBufLen); /* digest and null */
+	pwdBuf = SMB_MALLOC_ARRAY(char, pwdBufLen); /* digest and null */
 	if(pwdBuf == NULL)
 	{
 		return LDAP_NO_MEMORY;
@@ -568,7 +568,7 @@
 	}
 
 	bufferLen = pwdBufLen = *pwdSize;
-	pwdBuf = SMB_MALLOC(pwdBufLen+2);
+	pwdBuf = SMB_MALLOC_ARRAY(char, pwdBufLen+2);
 	if(pwdBuf == NULL)
 	{
 		return LDAP_NO_MEMORY;
@@ -769,7 +769,7 @@
 		DEBUG(5,("pdb_nds_update_login_attempts: %s login for %s\n",
 				success ? "Successful" : "Failed", username));
 
-		result = pdb_get_backend_private_data(sam_acct, methods);
+		result = (LDAPMessage *)pdb_get_backend_private_data(sam_acct, methods);
 		if (!result) {
 			attr_list = get_userattr_list(NULL,
 						      ldap_state->schema_ver);
@@ -854,7 +854,8 @@
 
 static NTSTATUS pdb_init_NDS_ldapsam_common(struct pdb_methods **pdb_method, const char *location)
 {
-	struct ldapsam_privates *ldap_state = (*pdb_method)->private_data;
+	struct ldapsam_privates *ldap_state =
+		(struct ldapsam_privates *)((*pdb_method)->private_data);
 
 	/* Mark this as eDirectory ldap */
 	ldap_state->is_nds_ldap = True;

Modified: trunk/source/passdb/pdb_smbpasswd.c
===================================================================
--- trunk/source/passdb/pdb_smbpasswd.c	2006-07-08 17:37:13 UTC (rev 16880)
+++ trunk/source/passdb/pdb_smbpasswd.c	2006-07-08 19:01:10 UTC (rev 16881)
@@ -1311,7 +1311,7 @@
 	NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
 	struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
 	struct smb_passwd *smb_pw;
-	void *fp = NULL;
+	FILE *fp = NULL;
 
 	DEBUG(10, ("getsampwnam (smbpasswd): search by name: %s\n", username));
 
@@ -1355,7 +1355,7 @@
 	NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
 	struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
 	struct smb_passwd *smb_pw;
-	void *fp = NULL;
+	FILE *fp = NULL;
 	fstring sid_str;
 	uint32 rid;
 	

Modified: trunk/source/passdb/pdb_tdb.c
===================================================================
--- trunk/source/passdb/pdb_tdb.c	2006-07-08 17:37:13 UTC (rev 16880)
+++ trunk/source/passdb/pdb_tdb.c	2006-07-08 19:01:10 UTC (rev 16881)
@@ -617,7 +617,7 @@
 	/* Change from V1 is addition of password history field. */
 	pdb_get_account_policy(AP_PASSWORD_HISTORY, &pwHistLen);
 	if (pwHistLen) {
-		uint8 *pw_hist = SMB_MALLOC(pwHistLen * PW_HISTORY_ENTRY_LEN);
+		uint8 *pw_hist = SMB_MALLOC_ARRAY(uint8, pwHistLen * PW_HISTORY_ENTRY_LEN);
 		if (!pw_hist) {
 			ret = False;
 			goto done;
@@ -912,7 +912,7 @@
 		
 		/* save a copy of the key */
 		
-		ptr->key.dptr = memdup( key.dptr, key.dsize );
+		ptr->key.dptr = (char *)memdup( key.dptr, key.dsize );
 		if (!ptr->key.dptr) {
 			DEBUG(0,("tdbsam_traverse_setpwent: memdup failed\n"));
 			/* just return 0 and let the traversal continue */

Modified: trunk/source/passdb/secrets.c
===================================================================
--- trunk/source/passdb/secrets.c	2006-07-08 17:37:13 UTC (rev 16880)
+++ trunk/source/passdb/secrets.c	2006-07-08 19:01:10 UTC (rev 16881)
@@ -105,7 +105,8 @@
 	if (!tdb)
 		return False;
 	return tdb_trans_store(tdb, string_tdb_data(key),
-			       make_tdb_data(data, size), TDB_REPLACE) == 0;
+			       make_tdb_data((const char *)data, size),
+			       TDB_REPLACE) == 0;
 }
 
 
@@ -288,7 +289,8 @@
 		return True;
 	}
 
-	if (!(pass = secrets_fetch(trust_keystr(domain), &size))) {
+	if (!(pass = (struct machine_acct_pass *)secrets_fetch(
+		      trust_keystr(domain), &size))) {
 		DEBUG(5, ("secrets_fetch failed!\n"));
 		return False;
 	}
@@ -466,7 +468,8 @@
 	ZERO_STRUCT(pass);
 
 	/* fetching trusted domain password structure */
-	if (!(pass_buf = secrets_fetch(trustdom_keystr(domain), &size))) {
+	if (!(pass_buf = (char *)secrets_fetch(trustdom_keystr(domain),
+					       &size))) {
 		DEBUG(5, ("secrets_fetch failed!\n"));
 		return False;
 	}
@@ -624,7 +627,7 @@
 		uint32 *last_set_time;
 		asprintf(&key, "%s/%s", SECRETS_MACHINE_LAST_CHANGE_TIME, domain);
 		strupper_m(key);
-		last_set_time = secrets_fetch(key, &size);
+		last_set_time = (unsigned int *)secrets_fetch(key, &size);
 		if (last_set_time) {
 			*pass_last_set_time = IVAL(last_set_time,0);
 			SAFE_FREE(last_set_time);
@@ -639,7 +642,7 @@
 		uint32 *channel_type;
 		asprintf(&key, "%s/%s", SECRETS_MACHINE_SEC_CHANNEL_TYPE, domain);
 		strupper_m(key);
-		channel_type = secrets_fetch(key, &size);
+		channel_type = (unsigned int *)secrets_fetch(key, &size);
 		if (channel_type) {
 			*channel = IVAL(channel_type,0);
 			SAFE_FREE(channel_type);
@@ -743,7 +746,7 @@
 		DEBUG(0, ("fetch_ldap_pw: asprintf failed!\n"));
 	}
 	
-	*pw=secrets_fetch(key, &size);
+	*pw=(char *)secrets_fetch(key, &size);
 	SAFE_FREE(key);
 
 	if (!size) {
@@ -761,7 +764,7 @@
 		for (p=old_style_key; *p; p++)
 			if (*p == ',') *p = '/';
 	
-		data=secrets_fetch(old_style_key, &size);
+		data=(char *)secrets_fetch(old_style_key, &size);
 		if (!size && size < sizeof(old_style_pw)) {
 			DEBUG(0,("fetch_ldap_pw: neither ldap secret retrieved!\n"));
 			SAFE_FREE(old_style_key);
@@ -853,7 +856,7 @@
 			return NT_STATUS_NO_MEMORY;
 		}
 
-		packed_pass = secrets_fetch(secrets_key, &size);
+		packed_pass = (char *)secrets_fetch(secrets_key, &size);
 		packed_size = tdb_trusted_dom_pass_unpack(packed_pass, size,
 							  &pass);
 		/* packed representation isn't needed anymore */
@@ -1006,9 +1009,9 @@
 *******************************************************************************/
 void secrets_fetch_ipc_userpass(char **username, char **domain, char **password)
 {
-	*username = secrets_fetch(SECRETS_AUTH_USER, NULL);
-	*domain = secrets_fetch(SECRETS_AUTH_DOMAIN, NULL);
-	*password = secrets_fetch(SECRETS_AUTH_PASSWORD, NULL);
+	*username = (char *)secrets_fetch(SECRETS_AUTH_USER, NULL);
+	*domain = (char *)secrets_fetch(SECRETS_AUTH_DOMAIN, NULL);
+	*password = (char *)secrets_fetch(SECRETS_AUTH_PASSWORD, NULL);
 	
 	if (*username && **username) {
 
@@ -1113,7 +1116,7 @@
 				pdc->remote_machine,
 				pdc->domain);
 
-	value.dptr = TALLOC(mem_ctx, value.dsize);
+	value.dptr = (char *)TALLOC(mem_ctx, value.dsize);
 	if (!value.dptr) {
 		TALLOC_FREE(keystr);
 		return False;



More information about the samba-cvs mailing list