[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-3573-gb62de0d

Günther Deschner gd at samba.org
Mon Aug 11 17:04:42 GMT 2008


The branch, v3-3-test has been updated
       via  b62de0d1944de3dba55e182e0d8eb7c6ca5ec045 (commit)
       via  99cc8f023b4ad9210b677e11371f404048752031 (commit)
       via  36f1e45e4ec295115f1ba39ec7ad3690a96dac3e (commit)
      from  a2247a5b19237291cec8c6a873652d78d55aaeb7 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit b62de0d1944de3dba55e182e0d8eb7c6ca5ec045
Author: Günther Deschner <gd at samba.org>
Date:   Fri Aug 1 17:22:00 2008 +0200

    doserr: add WERR_MEMBER_IN_ALIAS.
    
    Guenther

commit 99cc8f023b4ad9210b677e11371f404048752031
Author: Günther Deschner <gd at samba.org>
Date:   Fri Aug 1 16:44:05 2008 +0200

    netapi: add NetApiBufferAllocate.
    
    Guenther

commit 36f1e45e4ec295115f1ba39ec7ad3690a96dac3e
Author: Günther Deschner <gd at samba.org>
Date:   Fri Aug 1 15:15:05 2008 +0200

    netapi: add ConvertStringSidToSid().
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/include/doserr.h    |    1 +
 source/lib/netapi/netapi.c |   27 +++++++++++++++++++++++++++
 source/lib/netapi/netapi.h |   21 +++++++++++++++++++++
 source/lib/netapi/sid.c    |   26 ++++++++++++++++++++++++++
 source/libsmb/doserr.c     |    1 +
 5 files changed, 76 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/doserr.h b/source/include/doserr.h
index c455f7a..9dd20e8 100644
--- a/source/include/doserr.h
+++ b/source/include/doserr.h
@@ -222,6 +222,7 @@
 #define WERR_INVALID_DOMAIN_STATE W_ERROR(1353)
 #define WERR_INVALID_DOMAIN_ROLE W_ERROR(1354)
 #define WERR_SPECIAL_ACCOUNT W_ERROR(1371)
+#define WERR_MEMBER_IN_ALIAS W_ERROR(1378)
 #define WERR_ALIAS_EXISTS W_ERROR(1379)
 #define WERR_TIME_SKEW W_ERROR(1398)
 #define WERR_EVENTLOG_FILE_CORRUPT W_ERROR(1500)
diff --git a/source/lib/netapi/netapi.c b/source/lib/netapi/netapi.c
index 7d78aa8..8893881 100644
--- a/source/lib/netapi/netapi.c
+++ b/source/lib/netapi/netapi.c
@@ -309,6 +309,33 @@ const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
 /****************************************************************
 ****************************************************************/
 
+NET_API_STATUS NetApiBufferAllocate(uint32_t byte_count,
+				    void **buffer)
+{
+	void *buf = NULL;
+
+	if (!buffer) {
+		return W_ERROR_V(WERR_INSUFFICIENT_BUFFER);
+	}
+
+	if (byte_count == 0) {
+		goto done;
+	}
+
+	buf = talloc_size(NULL, byte_count);
+	if (!buf) {
+		return W_ERROR_V(WERR_NOMEM);
+	}
+
+ done:
+	*buffer = buf;
+
+	return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
 NET_API_STATUS NetApiBufferFree(void *buffer)
 {
 	if (!buffer) {
diff --git a/source/lib/netapi/netapi.h b/source/lib/netapi/netapi.h
index a1041c0..9cc8e9e 100644
--- a/source/lib/netapi/netapi.h
+++ b/source/lib/netapi/netapi.h
@@ -400,6 +400,12 @@ const char *libnetapi_errstr(NET_API_STATUS status);
 const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
 				       NET_API_STATUS status);
 
+/****************************************************************
+ NetApiBufferAllocate
+****************************************************************/
+
+NET_API_STATUS NetApiBufferAllocate(uint32_t byte_count,
+				    void **buffer);
 
 /****************************************************************
  NetApiBufferFree
@@ -424,6 +430,21 @@ int  ConvertSidToStringSid(const struct domsid *sid,
 
 /************************************************************//**
  *
+ * ConvertStringSidToSid
+ *
+ * @brief Convert a string into a domain sid
+ *
+ * @param[in] sid_string A pointer to a sid string.
+ * @param[in] sid A pointer that holds a pointer to a sid structure.
+ * Caller needs to free with free(3)
+ * @return bool
+ ***************************************************************/
+
+int ConvertStringSidToSid(const char *sid_string,
+			  struct domsid **sid);
+
+/************************************************************//**
+ *
  * NetJoinDomain
  *
  * @brief Join a computer to a domain or workgroup
diff --git a/source/lib/netapi/sid.c b/source/lib/netapi/sid.c
index 4db98bf..a9bca26 100644
--- a/source/lib/netapi/sid.c
+++ b/source/lib/netapi/sid.c
@@ -48,3 +48,29 @@ int ConvertSidToStringSid(const struct domsid *sid,
 
 	return true;
 }
+
+/****************************************************************
+****************************************************************/
+
+int ConvertStringSidToSid(const char *sid_string,
+			  struct domsid **sid)
+{
+	struct dom_sid _sid;
+
+	if (!sid_string || !sid) {
+		return false;
+	}
+
+	if (!string_to_sid(&_sid, sid_string)) {
+		return false;
+	}
+
+	*sid = (struct domsid *)SMB_MALLOC(sizeof(struct domsid));
+	if (!*sid) {
+		return false;
+	}
+
+	sid_copy((struct dom_sid*)*sid, &_sid);
+
+	return true;
+}
diff --git a/source/libsmb/doserr.c b/source/libsmb/doserr.c
index bbb12e0..50b5b22 100644
--- a/source/libsmb/doserr.c
+++ b/source/libsmb/doserr.c
@@ -99,6 +99,7 @@ werror_code_struct dos_errs[] =
 	{ "WERR_INVALID_DOMAIN_ROLE", WERR_INVALID_DOMAIN_ROLE },
 	{ "WERR_SPECIAL_ACCOUNT", WERR_SPECIAL_ACCOUNT },
 	{ "WERR_ALIAS_EXISTS", WERR_ALIAS_EXISTS },
+	{ "WERR_MEMBER_IN_ALIAS", WERR_MEMBER_IN_ALIAS },
 	{ "WERR_TIME_SKEW", WERR_TIME_SKEW },
 	{ "WERR_INVALID_OWNER", WERR_INVALID_OWNER },
 	{ "WERR_SERVER_UNAVAILABLE", WERR_SERVER_UNAVAILABLE },


-- 
Samba Shared Repository


More information about the samba-cvs mailing list