svn commit: samba r15430 - in trunk/source: . include lib libsmb rpc_parse

jelmer at samba.org jelmer at samba.org
Thu May 4 12:50:24 GMT 2006


Author: jelmer
Date: 2006-05-04 12:50:22 +0000 (Thu, 04 May 2006)
New Revision: 15430

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

Log:
My previous commit was only intended to commit include/talloc.h and lib/talloc.c, back out the other files for now (until I back them out again)

Modified:
   trunk/source/Doxyfile
   trunk/source/Makefile.in
   trunk/source/include/includes.h
   trunk/source/include/rpc_netlogon.h
   trunk/source/include/rpc_secdes.h
   trunk/source/lib/charcnv.c
   trunk/source/lib/data_blob.c
   trunk/source/lib/substitute.c
   trunk/source/lib/time.c
   trunk/source/lib/util.c
   trunk/source/lib/util_str.c
   trunk/source/libsmb/trusts_util.c
   trunk/source/rpc_parse/parse_dfs.c


Changeset:
Modified: trunk/source/Doxyfile
===================================================================
--- trunk/source/Doxyfile	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/Doxyfile	2006-05-04 12:50:22 UTC (rev 15430)
@@ -168,3 +168,9 @@
 # configuration::additions related to the search engine   
 #---------------------------------------------------------------------------
 SEARCHENGINE           = NO
+CGI_NAME               = search.cgi
+CGI_URL                = 
+DOC_URL                = 
+DOC_ABSPATH            = 
+BIN_ABSPATH            = /usr/local/bin/
+EXT_DOC_PATHS          = 

Modified: trunk/source/Makefile.in
===================================================================
--- trunk/source/Makefile.in	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/Makefile.in	2006-05-04 12:50:22 UTC (rev 15430)
@@ -201,9 +201,6 @@
 
 SOCKET_WRAPPER_OBJ = lib/socket_wrapper.o
 
-LIBNDR_OBJ = libndr/ndr_basic.o libndr/ndr.o libndr/ndr_misc.o \
-		libndr/ndr_sec_helper.o libndr/ndr_string.o libndr/sid.o
-
 RPC_PARSE_OBJ0 = rpc_parse/parse_prs.o rpc_parse/parse_misc.o
 
 LIB_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
@@ -334,7 +331,7 @@
 		rpc_parse/parse_echo.o rpc_parse/parse_shutdown.o \
 		rpc_parse/parse_svcctl.o rpc_parse/parse_unixinfo.o \
 		rpc_parse/parse_eventlog.o rpc_parse/parse_buffer.o \
-                rpc_parse/parse_ntsvcs.o $(REGOBJS_OBJ) $(LIBNDR_OBJ)
+                rpc_parse/parse_ntsvcs.o $(REGOBJS_OBJ)
 
 RPC_CLIENT_OBJ = rpc_client/cli_pipe.o
 
@@ -684,7 +681,7 @@
 SMBFILTER_OBJ = utils/smbfilter.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(SECRETS_OBJ) \
                  $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) 
 
-PROTO_OBJ = $(SMBD_OBJ_MAIN) $(LIBNDR_OBJ) \
+PROTO_OBJ = $(SMBD_OBJ_MAIN) \
 	    $(SMBD_OBJ_SRV) $(NMBD_OBJ1) $(SWAT_OBJ1) $(LIB_OBJ) $(LIBSMB_OBJ) \
 	    $(SMBTORTURE_OBJ1) $(RPCCLIENT_OBJ1) \
 	    $(LIBMSRPC_OBJ) @SMBWRAP_OBJS@ \

Modified: trunk/source/include/includes.h
===================================================================
--- trunk/source/include/includes.h	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/include/includes.h	2006-05-04 12:50:22 UTC (rev 15430)
@@ -1008,8 +1008,6 @@
 
 #include "event.h"
 
-#include "libndr/libndr.h"
-
 /*
  * Type for wide character dirent structure.
  * Only d_name is defined by POSIX.

Modified: trunk/source/include/rpc_netlogon.h
===================================================================
--- trunk/source/include/rpc_netlogon.h	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/include/rpc_netlogon.h	2006-05-04 12:50:22 UTC (rev 15430)
@@ -43,6 +43,11 @@
 #define NET_DSR_GETSITENAME	0x1c
 #define NET_SAMLOGON_EX		0x27
 
+/* Secure Channel types.  used in NetrServerAuthenticate negotiation */
+#define SEC_CHAN_WKSTA   2
+#define SEC_CHAN_DOMAIN  4
+#define SEC_CHAN_BDC     6
+
 /* Returned delta types */
 #define SAM_DELTA_DOMAIN_INFO    0x01
 #define SAM_DELTA_GROUP_INFO     0x02
@@ -61,6 +66,11 @@
 #define SAM_DELTA_DELETE_USER    0x15
 #define SAM_DELTA_MODIFIED_COUNT 0x16
 
+/* SAM database types */
+#define SAM_DATABASE_DOMAIN    0x00 /* Domain users and groups */
+#define SAM_DATABASE_BUILTIN   0x01 /* BUILTIN users and groups */
+#define SAM_DATABASE_PRIVS     0x02 /* Privileges */
+
 /* flags use when sending a NETLOGON_CONTROL request */
 
 #define NETLOGON_CONTROL_SYNC			0x2

Modified: trunk/source/include/rpc_secdes.h
===================================================================
--- trunk/source/include/rpc_secdes.h	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/include/rpc_secdes.h	2006-05-04 12:50:22 UTC (rev 15430)
@@ -43,6 +43,33 @@
 #define SEC_ACE_OBJECT_PRESENT           0x00000001 /* thanks for Jim McDonough <jmcd at us.ibm.com> */
 #define SEC_ACE_OBJECT_INHERITED_PRESENT 0x00000002
 
+#define SEC_ACE_FLAG_OBJECT_INHERIT		0x1
+#define SEC_ACE_FLAG_CONTAINER_INHERIT		0x2
+#define SEC_ACE_FLAG_NO_PROPAGATE_INHERIT	0x4
+#define SEC_ACE_FLAG_INHERIT_ONLY		0x8
+#define SEC_ACE_FLAG_INHERITED_ACE		0x10 /* New for Windows 2000 */
+#define SEC_ACE_FLAG_VALID_INHERIT		0xf
+#define SEC_ACE_FLAG_SUCCESSFUL_ACCESS		0x40
+#define SEC_ACE_FLAG_FAILED_ACCESS		0x80
+
+#define SEC_ACE_TYPE_ACCESS_ALLOWED		0x0
+#define SEC_ACE_TYPE_ACCESS_DENIED		0x1
+#define SEC_ACE_TYPE_SYSTEM_AUDIT		0x2
+#define SEC_ACE_TYPE_SYSTEM_ALARM		0x3
+#define SEC_ACE_TYPE_ALLOWED_COMPOUND		0x4
+#define SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT	0x5
+#define SEC_ACE_TYPE_ACCESS_DENIED_OBJECT     	0x6
+#define SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT      	0x7
+#define SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT	0x8
+
+#define SEC_DESC_OWNER_DEFAULTED	0x0001
+#define SEC_DESC_GROUP_DEFAULTED	0x0002
+#define SEC_DESC_DACL_PRESENT		0x0004
+#define SEC_DESC_DACL_DEFAULTED		0x0008
+#define SEC_DESC_SACL_PRESENT		0x0010
+#define SEC_DESC_SACL_DEFAULTED		0x0020
+#define SEC_DESC_DACL_TRUSTED		0x0040
+#define SEC_DESC_SERVER_SECURITY	0x0080
 /*
  * New Windows 2000 bits.
  */
@@ -53,6 +80,11 @@
 #define SE_DESC_DACL_PROTECTED		0x1000
 #define SE_DESC_SACL_PROTECTED		0x2000
 
+/* Don't know what this means. */
+#define SEC_DESC_RM_CONTROL_VALID	0x4000
+
+#define SEC_DESC_SELF_RELATIVE		0x8000
+
 /* security information */
 #define OWNER_SECURITY_INFORMATION	0x00000001
 #define GROUP_SECURITY_INFORMATION	0x00000002
@@ -102,6 +134,10 @@
 #define ACL_REVISION 0x3
 #endif
 
+#ifndef NT4_ACL_REVISION
+#define NT4_ACL_REVISION 0x2
+#endif
+
 #ifndef _SEC_ACL
 /* SEC_ACL */
 typedef struct security_acl_info

Modified: trunk/source/lib/charcnv.c
===================================================================
--- trunk/source/lib/charcnv.c	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/lib/charcnv.c	2006-05-04 12:50:22 UTC (rev 15430)
@@ -702,7 +702,7 @@
  *
  * @returns Size in bytes of the converted string; or -1 in case of error.
  **/
-size_t convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to,
+static size_t convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to,
 		      		void const *src, size_t srclen, void **dest, BOOL allow_bad_conv)
 {
 	size_t dest_len;

Modified: trunk/source/lib/data_blob.c
===================================================================
--- trunk/source/lib/data_blob.c	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/lib/data_blob.c	2006-05-04 12:50:22 UTC (rev 15430)
@@ -102,7 +102,7 @@
  Clear a DATA_BLOB's contents
 *******************************************************************/
 
-void data_blob_clear(DATA_BLOB *d)
+static void data_blob_clear(DATA_BLOB *d)
 {
 	if (d->data) {
 		memset(d->data, 0, d->length);

Modified: trunk/source/lib/substitute.c
===================================================================
--- trunk/source/lib/substitute.c	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/lib/substitute.c	2006-05-04 12:50:22 UTC (rev 15430)
@@ -522,7 +522,7 @@
 			a_string = realloc_string_sub(a_string, "%R", remote_proto);
 			break;
 		case 'T' :
-			a_string = realloc_string_sub(a_string, "%T", current_timestring(False));
+			a_string = realloc_string_sub(a_string, "%T", timestring(False));
 			break;
 		case 'a' :
 			a_string = realloc_string_sub(a_string, "%a", remote_arch);

Modified: trunk/source/lib/time.c
===================================================================
--- trunk/source/lib/time.c	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/lib/time.c	2006-05-04 12:50:22 UTC (rev 15430)
@@ -639,7 +639,7 @@
  Return the date and time as a string
 ****************************************************************************/
 
-char *current_timestring(BOOL hires)
+char *timestring(BOOL hires)
 {
 	static fstring TimeBuf;
 	struct timeval tp;
@@ -1057,49 +1057,3 @@
 	return ret;
 }
 #endif
-
-
-/**
- Return the date and time as a string
-**/
-char *timestring(TALLOC_CTX *mem_ctx, time_t t)
-{
-	char *TimeBuf;
-	char tempTime[80];
-	struct tm *tm;
-
-	tm = localtime(&t);
-	if (!tm) {
-		return talloc_asprintf(mem_ctx,
-				       "%ld seconds since the Epoch",
-				       (long)t);
-	}
-
-#ifdef HAVE_STRFTIME
-	/* some versions of gcc complain about using %c. This is a bug
-	   in the gcc warning, not a bug in this code. See a recent
-	   strftime() manual page for details.
-	 */
-	strftime(tempTime,sizeof(tempTime)-1,"%c %Z",tm);
-	TimeBuf = talloc_strdup(mem_ctx, tempTime);
-#else
-	TimeBuf = talloc_strdup(mem_ctx, asctime(tm));
-#endif
-
-	return TimeBuf;
-}
-
-
-/**
-  return a talloced string representing a NTTIME for human consumption
-*/
-const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt)
-{
-	time_t t;
-	if (nt.low == 0 && nt.high == 0) {
-		return "NTTIME(0)";
-	}
-	t = nt_time_to_unix(&nt);
-	return timestring(mem_ctx, t);
-}
-

Modified: trunk/source/lib/util.c
===================================================================
--- trunk/source/lib/util.c	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/lib/util.c	2006-05-04 12:50:22 UTC (rev 15430)
@@ -447,6 +447,26 @@
 }
 
 /*******************************************************************
+ Return a string representing an attribute for a file.
+********************************************************************/
+
+char *attrib_string(uint16 mode)
+{
+	static fstring attrstr;
+
+	attrstr[0] = 0;
+
+	if (mode & aVOLID) fstrcat(attrstr,"V");
+	if (mode & aDIR) fstrcat(attrstr,"D");
+	if (mode & aARCH) fstrcat(attrstr,"A");
+	if (mode & aHIDDEN) fstrcat(attrstr,"H");
+	if (mode & aSYSTEM) fstrcat(attrstr,"S");
+	if (mode & aRONLY) fstrcat(attrstr,"R");	  
+
+	return(attrstr);
+}
+
+/*******************************************************************
  Show a smb message structure.
 ********************************************************************/
 

Modified: trunk/source/lib/util_str.c
===================================================================
--- trunk/source/lib/util_str.c	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/lib/util_str.c	2006-05-04 12:50:22 UTC (rev 15430)
@@ -795,7 +795,40 @@
 	return num_chars;
 }
 
+DATA_BLOB strhex_to_data_blob(TALLOC_CTX *mem_ctx, const char *strhex) 
+{
+	DATA_BLOB ret_blob;
+
+	if (mem_ctx != NULL)
+		ret_blob = data_blob_talloc(mem_ctx, NULL, strlen(strhex)/2+1);
+	else
+		ret_blob = data_blob(NULL, strlen(strhex)/2+1);
+
+	ret_blob.length = strhex_to_str((char*)ret_blob.data, 	
+					strlen(strhex), 
+					strhex);
+
+	return ret_blob;
+}
+
 /**
+ * Routine to print a buffer as HEX digits, into an allocated string.
+ */
+
+char *hex_encode(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len)
+{
+	int i;
+	char *hex_buffer;
+
+	hex_buffer = TALLOC_ARRAY(mem_ctx, char, (len*2)+1);
+
+	for (i = 0; i < len; i++)
+		slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]);
+
+	return hex_buffer;
+}
+
+/**
  Check if a string is part of a list.
 **/
 
@@ -2382,52 +2415,3 @@
 	return True;
 }
 
-
-/**
-return the number of bytes occupied by a buffer in ASCII format
-the result includes the null termination
-limited by 'n' bytes
-**/
-size_t ascii_len_n(const char *src, size_t n)
-{
-	size_t len;
-
-	len = strnlen(src, n);
-	if (len+1 <= n) {
-		len += 1;
-	}
-
-	return len;
-}
-
-/**
-return the number of bytes occupied by a buffer in CH_UTF16 format
-the result includes the null termination
-**/
-size_t utf16_len(const void *buf)
-{
-	size_t len;
-
-	for (len = 0; SVAL(buf,len); len += 2) ;
-
-	return len + 2;
-}
-
-/**
-return the number of bytes occupied by a buffer in CH_UTF16 format
-the result includes the null termination
-limited by 'n' bytes
-**/
-size_t utf16_len_n(const void *src, size_t n)
-{
-	size_t len;
-
-	for (len = 0; (len+2 < n) && SVAL(src, len); len += 2) ;
-
-	if (len+2 <= n) {
-		len += 2;
-	}
-
-	return len;
-}
-

Modified: trunk/source/libsmb/trusts_util.c
===================================================================
--- trunk/source/libsmb/trusts_util.c	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/libsmb/trusts_util.c	2006-05-04 12:50:22 UTC (rev 15430)
@@ -95,7 +95,7 @@
 	
 	if (NT_STATUS_IS_OK(nt_status)) {
 		DEBUG(3,("%s : trust_pw_change_and_store_it: Changed password.\n", 
-			 current_timestring(False)));
+			 timestring(False)));
 		/*
 		 * Return the result of trying to write the new password
 		 * back into the trust account file.

Modified: trunk/source/rpc_parse/parse_dfs.c
===================================================================
--- trunk/source/rpc_parse/parse_dfs.c	2006-05-04 12:44:37 UTC (rev 15429)
+++ trunk/source/rpc_parse/parse_dfs.c	2006-05-04 12:50:22 UTC (rev 15430)
@@ -1546,6 +1546,9 @@
 	
 	prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Add");
 	depth++;
+	if (!prs_align_custom(ps, 4))
+		return False;
+	
 	if (!smb_io_unistr2("path", &v->path, 1, ps, depth))
 		return False;
 	
@@ -1562,6 +1565,9 @@
 		return False;
 	
 	if (v->ptr0_share) {
+		if (!prs_align_custom(ps, 4))
+			return False;
+		
 		if (!smb_io_unistr2("share", &v->share, 1, ps, depth))
 			return False;
 	}
@@ -1573,6 +1579,9 @@
 		return False;
 	
 	if (v->ptr0_comment) {
+		if (!prs_align_custom(ps, 4))
+			return False;
+		
 		if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth))
 			return False;
 	}
@@ -1641,6 +1650,9 @@
 	
 	prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Remove");
 	depth++;
+	if (!prs_align_custom(ps, 4))
+		return False;
+	
 	if (!smb_io_unistr2("path", &v->path, 1, ps, depth))
 		return False;
 	
@@ -1651,6 +1663,9 @@
 		return False;
 	
 	if (v->ptr0_server) {
+		if (!prs_align_custom(ps, 4))
+			return False;
+		
 		if (!smb_io_unistr2("server", &v->server, 1, ps, depth))
 			return False;
 	}
@@ -1662,6 +1677,9 @@
 		return False;
 	
 	if (v->ptr0_share) {
+		if (!prs_align_custom(ps, 4))
+			return False;
+		
 		if (!smb_io_unistr2("share", &v->share, 1, ps, depth))
 			return False;
 	}
@@ -1765,6 +1783,9 @@
 	
 	prs_debug(ps, depth, desc, "netdfs_io_q_dfs_GetInfo");
 	depth++;
+	if (!prs_align_custom(ps, 4))
+		return False;
+	
 	if (!smb_io_unistr2("path", &v->path, 1, ps, depth))
 		return False;
 	
@@ -1775,6 +1796,9 @@
 		return False;
 	
 	if (v->ptr0_server) {
+		if (!prs_align_custom(ps, 4))
+			return False;
+		
 		if (!smb_io_unistr2("server", &v->server, 1, ps, depth))
 			return False;
 	}
@@ -1786,6 +1810,9 @@
 		return False;
 	
 	if (v->ptr0_share) {
+		if (!prs_align_custom(ps, 4))
+			return False;
+		
 		if (!smb_io_unistr2("share", &v->share, 1, ps, depth))
 			return False;
 	}



More information about the samba-cvs mailing list