aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/samba36/patches/280-strip_srvsvc.patch
blob: b93e3fce6a120462356bcbe7d1fbbe802d749ec9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -2197,6 +2197,10 @@ static bool api_RNetShareAdd(struct smbd
 	struct srvsvc_NetShareInfo2 info2;
 	struct dcerpc_binding_handle *b;
 
+#ifndef SRVSVC_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
@@ -3838,10 +3842,7 @@ static bool api_RNetServerGetInfo(struct
 	NTSTATUS status;
 	WERROR werr;
 	TALLOC_CTX *mem_ctx = talloc_tos();
-	struct rpc_pipe_client *cli = NULL;
-	union srvsvc_NetSrvInfo info;
 	int errcode;
-	struct dcerpc_binding_handle *b;
 
 	if (!str1 || !str2 || !p) {
 		return False;
@@ -3904,66 +3905,16 @@ static bool api_RNetServerGetInfo(struct
 	p = *rdata;
 	p2 = p + struct_len;
 
-	status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id,
-					conn->session_info,
-					&conn->sconn->client_id,
-					conn->sconn->msg_ctx,
-					&cli);
-	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(0,("api_RNetServerGetInfo: could not connect to srvsvc: %s\n",
-			  nt_errstr(status)));
-		errcode = W_ERROR_V(ntstatus_to_werror(status));
-		goto out;
-	}
-
-	b = cli->binding_handle;
-
-	status = dcerpc_srvsvc_NetSrvGetInfo(b, mem_ctx,
-					     NULL,
-					     101,
-					     &info,
-					     &werr);
-	if (!NT_STATUS_IS_OK(status)) {
-		errcode = W_ERROR_V(ntstatus_to_werror(status));
-		goto out;
-	}
-	if (!W_ERROR_IS_OK(werr)) {
-		errcode = W_ERROR_V(werr);
-		goto out;
-	}
-
-	if (info.info101 == NULL) {
-		errcode = W_ERROR_V(WERR_INVALID_PARAM);
-		goto out;
-	}
-
 	if (uLevel != 20) {
-		srvstr_push(NULL, 0, p, info.info101->server_name, 16,
+		srvstr_push(NULL, 0, p, global_myname(), 16,
 			STR_ASCII|STR_UPPER|STR_TERMINATE);
-  	}
+	}
 	p += 16;
 	if (uLevel > 0) {
-		SCVAL(p,0,info.info101->version_major);
-		SCVAL(p,1,info.info101->version_minor);
-		SIVAL(p,2,info.info101->server_type);
-
-		if (mdrcnt == struct_len) {
-			SIVAL(p,6,0);
-		} else {
-			SIVAL(p,6,PTR_DIFF(p2,*rdata));
-			if (mdrcnt - struct_len <= 0) {
-				return false;
-			}
-			push_ascii(p2,
-				info.info101->comment,
-				MIN(mdrcnt - struct_len,
-					MAX_SERVER_STRING_LENGTH),
-				STR_TERMINATE);
-			p2 = skip_string(*rdata,*rdata_len,p2);
-			if (!p2) {
-				return False;
-			}
-		}
+		SCVAL(p,0,lp_major_announce_version());
+		SCVAL(p,1,lp_minor_announce_version());
+		SIVAL(p,2,lp_default_server_announce());
+		SIVAL(p,6,0);
 	}
 
 	if (uLevel > 1) {
@@ -5654,6 +5605,10 @@ static bool api_RNetSessionEnum(struct s
 	uint32_t totalentries, resume_handle = 0;
 	uint32_t count = 0;
 
+#ifndef SRVSVC_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -1533,6 +1533,10 @@ WERROR _srvsvc_NetShareSetInfo(struct pi
 	TALLOC_CTX *ctx = p->mem_ctx;
 	union srvsvc_NetShareInfo *info = r->in.info;
 
+#ifndef FULL_SRVSVC
+	return WERR_ACCESS_DENIED;
+#endif
+
 	DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__));
 
 	if (!r->in.share_name) {
@@ -1763,6 +1767,10 @@ WERROR _srvsvc_NetShareAdd(struct pipes_
 	int max_connections = 0;
 	TALLOC_CTX *ctx = p->mem_ctx;
 
+#ifndef FULL_SRVSVC
+	return WERR_ACCESS_DENIED;
+#endif
+
 	DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__));
 
 	if (r->out.parm_error) {
@@ -1945,6 +1953,10 @@ WERROR _srvsvc_NetShareDel(struct pipes_
 	struct share_params *params;
 	TALLOC_CTX *ctx = p->mem_ctx;
 
+#ifndef FULL_SRVSVC
+	return WERR_ACCESS_DENIED;
+#endif
+
 	DEBUG(5,("_srvsvc_NetShareDel: %d\n", __LINE__));
 
 	if (!r->in.share_name) {