Changeset 988 for vendor/current/source3/lib/netapi
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/source3/lib/netapi
- Files:
-
- 4 added
- 2 deleted
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/lib/netapi/cm.c
r740 r988 19 19 20 20 #include "includes.h" 21 #include " popt_common.h"21 #include "auth_info.h" 22 22 23 23 #include "lib/netapi/netapi.h" … … 25 25 #include "libsmb/libsmb.h" 26 26 #include "rpc_client/cli_pipe.h" 27 #include "../libcli/smb/smbXcli_base.h" 27 28 28 29 /******************************************************************** … … 49 50 50 51 for (p = priv_ctx->ipc_connections; p; p = p->next) { 51 if (strequal(p->cli->desthost, server_name)) { 52 const char *remote_name = smbXcli_conn_remote_name(p->cli->conn); 53 54 if (strequal(remote_name, server_name)) { 52 55 return p; 53 56 } … … 64 67 struct client_ipc_connection **pp) 65 68 { 66 struct libnetapi_private_ctx *priv_ctx = 67 (struct libnetapi_private_ctx *)ctx->private_data; 69 struct libnetapi_private_ctx *priv_ctx; 68 70 struct user_auth_info *auth_info = NULL; 69 71 struct cli_state *cli_ipc = NULL; 70 72 struct client_ipc_connection *p; 73 NTSTATUS status; 71 74 72 75 if (!ctx || !pp || !server_name) { 73 76 return WERR_INVALID_PARAM; 74 77 } 78 79 priv_ctx = (struct libnetapi_private_ctx *)ctx->private_data; 75 80 76 81 p = ipc_cm_find(priv_ctx, server_name); … … 84 89 return WERR_NOMEM; 85 90 } 86 auth_info->signing_state = Undefined;91 auth_info->signing_state = SMB_SIGNING_IPC_DEFAULT; 87 92 set_cmdline_auth_info_use_kerberos(auth_info, ctx->use_kerberos); 88 93 set_cmdline_auth_info_username(auth_info, ctx->username); … … 103 108 } 104 109 105 cli_ipc = cli_cm_open(ctx, NULL, 106 server_name, "IPC$", 107 auth_info, 108 false, false, 109 PROTOCOL_NT1, 110 0, 0x20); 111 if (cli_ipc) { 112 cli_set_username(cli_ipc, ctx->username); 113 cli_set_password(cli_ipc, ctx->password); 114 cli_set_domain(cli_ipc, ctx->workgroup); 110 status = cli_cm_open(ctx, NULL, 111 server_name, "IPC$", 112 auth_info, 113 false, false, 114 lp_client_max_protocol(), 115 0, 0x20, &cli_ipc); 116 if (!NT_STATUS_IS_OK(status)) { 117 cli_ipc = NULL; 115 118 } 116 119 TALLOC_FREE(auth_info); … … 122 125 } 123 126 124 p = TALLOC_ZERO_P(ctx, struct client_ipc_connection);127 p = talloc_zero(ctx, struct client_ipc_connection); 125 128 if (p == NULL) { 126 129 return WERR_NOMEM; … … 155 158 156 159 static NTSTATUS pipe_cm_find(struct client_ipc_connection *ipc, 157 const struct ndr_ syntax_id *interface,160 const struct ndr_interface_table *table, 158 161 struct rpc_pipe_client **presult) 159 162 { … … 161 164 162 165 for (p = ipc->pipe_connections; p; p = p->next) { 163 164 if (!rpc_pipe_np_smb_conn(p->pipe)) { 166 const char *ipc_remote_name; 167 168 if (!rpccli_is_connected(p->pipe)) { 165 169 return NT_STATUS_PIPE_EMPTY; 166 170 } 167 171 168 if (strequal(ipc->cli->desthost, p->pipe->desthost) 172 ipc_remote_name = smbXcli_conn_remote_name(ipc->cli->conn); 173 174 if (strequal(ipc_remote_name, p->pipe->desthost) 169 175 && ndr_syntax_id_equal(&p->pipe->abstract_syntax, 170 interface)) {176 &table->syntax_id)) { 171 177 *presult = p->pipe; 172 178 return NT_STATUS_OK; … … 182 188 static NTSTATUS pipe_cm_connect(TALLOC_CTX *mem_ctx, 183 189 struct client_ipc_connection *ipc, 184 const struct ndr_ syntax_id *interface,190 const struct ndr_interface_table *table, 185 191 struct rpc_pipe_client **presult) 186 192 { … … 188 194 NTSTATUS status; 189 195 190 p = TALLOC_ZERO_ARRAY(mem_ctx, struct client_pipe_connection, 1);196 p = talloc_zero_array(mem_ctx, struct client_pipe_connection, 1); 191 197 if (!p) { 192 198 return NT_STATUS_NO_MEMORY; 193 199 } 194 200 195 status = cli_rpc_pipe_open_noauth(ipc->cli, interface, &p->pipe);201 status = cli_rpc_pipe_open_noauth(ipc->cli, table, &p->pipe); 196 202 if (!NT_STATUS_IS_OK(status)) { 197 203 TALLOC_FREE(p); … … 210 216 static NTSTATUS pipe_cm_open(TALLOC_CTX *ctx, 211 217 struct client_ipc_connection *ipc, 212 const struct ndr_ syntax_id *interface,218 const struct ndr_interface_table *table, 213 219 struct rpc_pipe_client **presult) 214 220 { 215 if (NT_STATUS_IS_OK(pipe_cm_find(ipc, interface, presult))) {221 if (NT_STATUS_IS_OK(pipe_cm_find(ipc, table, presult))) { 216 222 return NT_STATUS_OK; 217 223 } 218 224 219 return pipe_cm_connect(ctx, ipc, interface, presult);225 return pipe_cm_connect(ctx, ipc, table, presult); 220 226 } 221 227 … … 225 231 WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx, 226 232 const char *server_name, 227 const struct ndr_ syntax_id *interface,233 const struct ndr_interface_table *table, 228 234 struct rpc_pipe_client **presult) 229 235 { … … 242 248 } 243 249 244 status = pipe_cm_open(ctx, ipc, interface, &result);250 status = pipe_cm_open(ctx, ipc, table, &result); 245 251 if (!NT_STATUS_IS_OK(status)) { 246 252 libnetapi_set_error_string(ctx, "failed to open PIPE %s: %s", 247 get_pipe_name_from_syntax(talloc_tos(), interface),253 table->name, 248 254 get_friendly_nt_error_msg(status)); 249 255 return WERR_DEST_NOT_FOUND; … … 260 266 WERROR libnetapi_get_binding_handle(struct libnetapi_ctx *ctx, 261 267 const char *server_name, 262 const struct ndr_ syntax_id *interface,268 const struct ndr_interface_table *table, 263 269 struct dcerpc_binding_handle **binding_handle) 264 270 { … … 268 274 *binding_handle = NULL; 269 275 270 result = libnetapi_open_pipe(ctx, server_name, interface, &pipe_cli);276 result = libnetapi_open_pipe(ctx, server_name, table, &pipe_cli); 271 277 if (!W_ERROR_IS_OK(result)) { 272 278 return result; -
vendor/current/source3/lib/netapi/examples/common.c
r414 r988 6 6 #include <popt.h> 7 7 #include <netapi.h> 8 9 #include "common.h" 8 10 9 11 void popt_common_callback(poptContext con, -
vendor/current/source3/lib/netapi/examples/common.h
r414 r988 8 8 extern struct poptOption popt_common_netapi_examples[]; 9 9 10 #ifndef POPT_TABLEEND 11 #define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL } 12 #endif 13 10 14 #define POPT_COMMON_LIBNETAPI_EXAMPLES { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_netapi_examples, 0, "Common samba netapi example options:", NULL }, 11 15 -
vendor/current/source3/lib/netapi/examples/join/getjoininformation.c
r414 r988 18 18 */ 19 19 20 #include "replace.h" 20 21 #include <string.h> 21 22 #include <stdio.h> … … 31 32 NET_API_STATUS status; 32 33 const char *host_name = NULL; 33 const char *name_buffer = NULL; 34 char *name_buffer = NULL; 35 const char *p = NULL; 34 36 uint16_t name_type = 0; 35 37 struct libnetapi_ctx *ctx = NULL; … … 63 65 /* NetGetJoinInformation */ 64 66 65 status = NetGetJoinInformation(host_name, 66 &name_buffer, 67 &name_type); 67 status = NetGetJoinInformation(host_name, &p, &name_type); 68 name_buffer = discard_const_p(char, p); 68 69 if (status != 0) { 69 70 printf("failed with: %s\n", … … 97 98 98 99 out: 99 NetApiBufferFree( (void *)name_buffer);100 NetApiBufferFree(name_buffer); 100 101 libnetapi_free(ctx); 101 102 poptFreeContext(pc); -
vendor/current/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
r740 r988 1172 1172 gtk_container_add(GTK_CONTAINER(window), box1); 1173 1173 1174 label = gtk_label_new("You can change the name and membership of this computer. Changes may affect access to network res sources.");1174 label = gtk_label_new("You can change the name and membership of this computer. Changes may affect access to network resources."); 1175 1175 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); 1176 1176 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); -
vendor/current/source3/lib/netapi/examples/netlogon/netlogon_control2.c
r414 r988 40 40 struct NETLOGON_INFO_3 *i3 = NULL; 41 41 struct NETLOGON_INFO_4 *i4 = NULL; 42 c onst char *domain = NULL;42 char *domain = NULL; 43 43 44 44 poptContext pc; … … 76 76 } 77 77 78 domain = "TEST";78 domain = strdup("TEST"); 79 79 80 80 /* I_NetLogonControl2 */ -
vendor/current/source3/lib/netapi/examples/netlogon/nltest.c
r740 r988 150 150 if (flags & DS_FULL_SECRET_DOMAIN_6_FLAG) 151 151 printf("FULL_SECRET "); 152 /* "WS" */ 152 if (flags & DS_WS_FLAG) 153 printf("WS "); 154 if (flags & DS_DS_8_FLAG) 155 printf("DS_8 "); 153 156 printf("\n"); 154 157 } … … 287 290 NETLOGON_CONTROL_SET_DBFLAG, 288 291 query_level, 289 (uint8_t *) opt_dbflag,292 (uint8_t *)&opt_dbflag, 290 293 &buffer); 291 294 if (status != 0) { -
vendor/current/source3/lib/netapi/examples/server/server_getinfo.c
r414 r988 39 39 struct SERVER_INFO_101 *i101; 40 40 struct SERVER_INFO_102 *i102; 41 struct SERVER_INFO_402 *i402;42 struct SERVER_INFO_403 *i403;43 struct SERVER_INFO_502 *i502;44 struct SERVER_INFO_503 *i503;45 41 struct SERVER_INFO_1005 *i1005; 46 42 … … 118 114 break; 119 115 case 402: 120 i402 = (struct SERVER_INFO_402 *)buffer;121 116 break; 122 117 case 403: 123 i403 = (struct SERVER_INFO_403 *)buffer;124 118 break; 125 119 case 502: 126 i502 = (struct SERVER_INFO_502 *)buffer;127 120 break; 128 121 case 503: 129 i503 = (struct SERVER_INFO_503 *)buffer;130 122 break; 131 123 case 1005: -
vendor/current/source3/lib/netapi/examples/share/share_add.c
r414 r988 35 35 const char *sharename = NULL; 36 36 const char *path = NULL; 37 uint32_t level = 0;38 37 uint32_t parm_err = 0; 39 38 … … 78 77 path = poptGetArg(pc); 79 78 80 if (poptPeekArg(pc)) {81 level = atoi(poptGetArg(pc));82 }83 84 79 /* NetShareAdd */ 85 80 -
vendor/current/source3/lib/netapi/examples/user/user_modalsset.c
r414 r988 35 35 uint8_t *buffer = NULL; 36 36 uint32_t level = 0; 37 uint32_t value = 0;38 37 uint32_t parm_err = 0; 39 38 40 39 struct USER_MODALS_INFO_0 u0; 41 struct USER_MODALS_INFO_1 u1;42 struct USER_MODALS_INFO_2 u2;43 struct USER_MODALS_INFO_3 u3;44 40 struct USER_MODALS_INFO_1001 u1001; 45 41 struct USER_MODALS_INFO_1002 u1002; … … 47 43 struct USER_MODALS_INFO_1004 u1004; 48 44 struct USER_MODALS_INFO_1005 u1005; 49 struct USER_MODALS_INFO_1006 u1006;50 struct USER_MODALS_INFO_1007 u1007;51 45 52 46 poptContext pc; … … 78 72 if (poptPeekArg(pc)) { 79 73 level = atoi(poptGetArg(pc)); 80 }81 82 if (poptPeekArg(pc)) {83 value = atoi(poptGetArg(pc));84 74 } 85 75 -
vendor/current/source3/lib/netapi/examples/user/user_setinfo.c
r414 r988 40 40 41 41 struct USER_INFO_0 u0; 42 struct USER_INFO_1 u1;43 struct USER_INFO_2 u2;44 struct USER_INFO_3 u3;45 struct USER_INFO_4 u4;46 struct USER_INFO_21 u21;47 struct USER_INFO_22 u22;48 42 struct USER_INFO_1003 u1003; 49 43 struct USER_INFO_1005 u1005; … … 57 51 struct USER_INFO_1014 u1014; 58 52 struct USER_INFO_1017 u1017; 59 struct USER_INFO_1020 u1020;60 53 struct USER_INFO_1024 u1024; 61 54 struct USER_INFO_1051 u1051; -
vendor/current/source3/lib/netapi/file.c
r740 r988 37 37 38 38 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 39 &ndr_table_srvsvc .syntax_id,39 &ndr_table_srvsvc, 40 40 &b); 41 41 if (!W_ERROR_IS_OK(werr)) { … … 131 131 132 132 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 133 &ndr_table_srvsvc .syntax_id,133 &ndr_table_srvsvc, 134 134 &b); 135 135 if (!W_ERROR_IS_OK(werr)) { … … 202 202 203 203 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 204 &ndr_table_srvsvc .syntax_id,204 &ndr_table_srvsvc, 205 205 &b); 206 206 if (!W_ERROR_IS_OK(werr)) { … … 241 241 242 242 for (i=0; i < info_ctr.ctr.ctr2->count; i++) { 243 union srvsvc_NetFileInfo _i ;243 union srvsvc_NetFileInfo _i = {0}; 244 244 switch (r->in.level) { 245 245 case 2: -
vendor/current/source3/lib/netapi/getdc.c
r740 r988 44 44 WERROR werr; 45 45 struct dcerpc_binding_handle *b; 46 const char *dcname; 47 void *buffer; 46 48 47 49 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 48 &ndr_table_netlogon .syntax_id,50 &ndr_table_netlogon, 49 51 &b); 50 52 if (!W_ERROR_IS_OK(werr)) { … … 55 57 r->in.server_name, 56 58 r->in.domain_name, 57 (const char **)r->out.buffer,59 &dcname, 58 60 &werr); 59 61 60 62 if (!NT_STATUS_IS_OK(status)) { 61 63 werr = ntstatus_to_werror(status); 62 } 64 goto done; 65 } 66 67 if (!W_ERROR_IS_OK(werr)) { 68 goto done; 69 } 70 71 if (NetApiBufferAllocate(strlen_m_term(dcname), &buffer)) { 72 werr = WERR_NOMEM; 73 goto done; 74 } 75 memcpy(buffer, dcname, strlen_m_term(dcname)); 76 *r->out.buffer = buffer; 63 77 done: 64 78 … … 84 98 WERROR werr; 85 99 struct dcerpc_binding_handle *b; 100 const char *dcname; 101 void *buffer; 86 102 87 103 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 88 &ndr_table_netlogon .syntax_id,104 &ndr_table_netlogon, 89 105 &b); 90 106 if (!W_ERROR_IS_OK(werr)) { … … 95 111 r->in.server_name, 96 112 r->in.domain_name, 97 (const char **)r->out.buffer,113 &dcname, 98 114 &werr); 99 115 if (!NT_STATUS_IS_OK(status)) { … … 101 117 goto done; 102 118 } 119 120 if (!W_ERROR_IS_OK(werr)) { 121 goto done; 122 } 123 124 if (NetApiBufferAllocate(strlen_m_term(dcname), &buffer)) { 125 werr = WERR_NOMEM; 126 goto done; 127 } 128 memcpy(buffer, dcname, strlen_m_term(dcname)); 129 *r->out.buffer = buffer; 130 103 131 done: 104 132 … … 146 174 147 175 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 148 &ndr_table_netlogon .syntax_id,176 &ndr_table_netlogon, 149 177 &b); 150 178 if (!W_ERROR_IS_OK(werr)) { -
vendor/current/source3/lib/netapi/group.c
r860 r988 77 77 78 78 werr = libnetapi_open_pipe(ctx, r->in.server_name, 79 &ndr_table_samr .syntax_id,79 &ndr_table_samr, 80 80 &pipe_cli); 81 81 if (!W_ERROR_IS_OK(werr)) { … … 273 273 274 274 werr = libnetapi_open_pipe(ctx, r->in.server_name, 275 &ndr_table_samr .syntax_id,275 &ndr_table_samr, 276 276 &pipe_cli); 277 277 if (!W_ERROR_IS_OK(werr)) { … … 493 493 494 494 werr = libnetapi_open_pipe(ctx, r->in.server_name, 495 &ndr_table_samr .syntax_id,495 &ndr_table_samr, 496 496 &pipe_cli); 497 497 if (!W_ERROR_IS_OK(werr)) { … … 771 771 772 772 werr = libnetapi_open_pipe(ctx, r->in.server_name, 773 &ndr_table_samr .syntax_id,773 &ndr_table_samr, 774 774 &pipe_cli); 775 775 if (!W_ERROR_IS_OK(werr)) { … … 919 919 920 920 werr = libnetapi_open_pipe(ctx, r->in.server_name, 921 &ndr_table_samr .syntax_id,921 &ndr_table_samr, 922 922 &pipe_cli); 923 923 if (!W_ERROR_IS_OK(werr)) { … … 1079 1079 1080 1080 werr = libnetapi_open_pipe(ctx, r->in.server_name, 1081 &ndr_table_samr .syntax_id,1081 &ndr_table_samr, 1082 1082 &pipe_cli); 1083 1083 if (!W_ERROR_IS_OK(werr)) { … … 1223 1223 int i; 1224 1224 1225 g0 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_0, groups->count);1225 g0 = talloc_zero_array(mem_ctx, struct GROUP_INFO_0, groups->count); 1226 1226 W_ERROR_HAVE_NO_MEMORY(g0); 1227 1227 … … 1249 1249 int i; 1250 1250 1251 g1 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_1, groups->count);1251 g1 = talloc_zero_array(mem_ctx, struct GROUP_INFO_1, groups->count); 1252 1252 W_ERROR_HAVE_NO_MEMORY(g1); 1253 1253 … … 1277 1277 int i; 1278 1278 1279 g2 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_2, groups->count);1279 g2 = talloc_zero_array(mem_ctx, struct GROUP_INFO_2, groups->count); 1280 1280 W_ERROR_HAVE_NO_MEMORY(g2); 1281 1281 … … 1308 1308 int i; 1309 1309 1310 g3 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_3, groups->count);1310 g3 = talloc_zero_array(mem_ctx, struct GROUP_INFO_3, groups->count); 1311 1311 W_ERROR_HAVE_NO_MEMORY(g3); 1312 1312 … … 1398 1398 1399 1399 werr = libnetapi_open_pipe(ctx, r->in.server_name, 1400 &ndr_table_samr .syntax_id,1400 &ndr_table_samr, 1401 1401 &pipe_cli); 1402 1402 if (!W_ERROR_IS_OK(werr)) { … … 1525 1525 ZERO_STRUCT(connect_handle); 1526 1526 ZERO_STRUCT(domain_handle); 1527 ZERO_STRUCT(group_handle); 1527 1528 1528 1529 if (!r->out.buffer) { … … 1544 1545 1545 1546 werr = libnetapi_open_pipe(ctx, r->in.server_name, 1546 &ndr_table_samr .syntax_id,1547 &ndr_table_samr, 1547 1548 &pipe_cli); 1548 1549 if (!W_ERROR_IS_OK(werr)) { … … 1721 1722 ZERO_STRUCT(connect_handle); 1722 1723 ZERO_STRUCT(domain_handle); 1724 ZERO_STRUCT(group_handle); 1723 1725 1724 1726 if (!r->in.buffer) { … … 1735 1737 1736 1738 werr = libnetapi_open_pipe(ctx, r->in.server_name, 1737 &ndr_table_samr .syntax_id,1739 &ndr_table_samr, 1738 1740 &pipe_cli); 1739 1741 if (!W_ERROR_IS_OK(werr)) { -
vendor/current/source3/lib/netapi/joindomain.c
r740 r988 116 116 DATA_BLOB session_key; 117 117 118 if (IS_DC) { 119 return WERR_SETUP_DOMAIN_CONTROLLER; 120 } 121 118 122 werr = libnetapi_open_pipe(ctx, r->in.server, 119 &ndr_table_wkssvc .syntax_id,123 &ndr_table_wkssvc, 120 124 &pipe_cli); 121 125 if (!W_ERROR_IS_OK(werr)) { … … 258 262 259 263 werr = libnetapi_open_pipe(ctx, r->in.server_name, 260 &ndr_table_wkssvc .syntax_id,264 &ndr_table_wkssvc, 261 265 &pipe_cli); 262 266 if (!W_ERROR_IS_OK(werr)) { … … 314 318 315 319 werr = libnetapi_open_pipe(ctx, r->in.server_name, 316 &ndr_table_wkssvc .syntax_id,320 &ndr_table_wkssvc, 317 321 &pipe_cli); 318 322 if (!W_ERROR_IS_OK(werr)) { … … 388 392 DS_RETURN_DNS_NAME; 389 393 struct libnetapi_private_ctx *priv; 394 char **p; 395 size_t s; 390 396 391 397 priv = talloc_get_type_abort(ctx->private_data, … … 427 433 } 428 434 429 ads_status = ads_get_joinable_ous(ads, ctx, 430 (char ***)r->out.ous, 431 (size_t *)r->out.ou_count); 435 ads_status = ads_get_joinable_ous(ads, ctx, &p, &s); 432 436 if (!ADS_ERR_OK(ads_status)) { 433 437 ads_destroy(&ads); 434 438 return WERR_DEFAULT_JOIN_REQUIRED; 435 439 } 440 *r->out.ous = discard_const_p(const char *, p); 441 *r->out.ou_count = s; 436 442 437 443 ads_destroy(&ads); … … 456 462 457 463 werr = libnetapi_open_pipe(ctx, r->in.server_name, 458 &ndr_table_wkssvc .syntax_id,464 &ndr_table_wkssvc, 459 465 &pipe_cli); 460 466 if (!W_ERROR_IS_OK(werr)) { … … 509 515 510 516 werr = libnetapi_open_pipe(ctx, r->in.server_name, 511 &ndr_table_wkssvc .syntax_id,517 &ndr_table_wkssvc, 512 518 &pipe_cli); 513 519 if (!W_ERROR_IS_OK(werr)) { -
vendor/current/source3/lib/netapi/libnetapi.c
r740 r988 375 375 376 376 /**************************************************************** 377 NetWkstaGetInfo 378 ****************************************************************/ 379 380 NET_API_STATUS NetWkstaGetInfo(const char * wksta_name /* [in] [unique] */, 381 uint32_t level /* [in] */, 382 uint8_t **buffer /* [out] [ref] */) 383 { 384 struct NetWkstaGetInfo r; 385 struct libnetapi_ctx *ctx = NULL; 386 NET_API_STATUS status; 387 WERROR werr; 388 TALLOC_CTX *frame = talloc_stackframe(); 389 390 status = libnetapi_getctx(&ctx); 391 if (status != 0) { 392 TALLOC_FREE(frame); 393 return status; 394 } 395 396 /* In parameters */ 397 r.in.server_name = wksta_name; 398 r.in.level = level; 399 400 /* Out parameters */ 401 r.out.buffer = buffer; 402 403 if (DEBUGLEVEL >= 10) { 404 NDR_PRINT_IN_DEBUG(NetWkstaGetInfo, &r); 405 } 406 407 if (LIBNETAPI_LOCAL_SERVER(wksta_name)) { 408 werr = NetWkstaGetInfo_l(ctx, &r); 409 } else { 410 werr = NetWkstaGetInfo_r(ctx, &r); 411 } 412 413 r.out.result = W_ERROR_V(werr); 414 415 if (DEBUGLEVEL >= 10) { 416 NDR_PRINT_OUT_DEBUG(NetWkstaGetInfo, &r); 417 } 418 419 TALLOC_FREE(frame); 420 return (NET_API_STATUS)r.out.result; 421 } 422 423 /**************************************************************** 377 424 NetGetDCName 378 425 ****************************************************************/ -
vendor/current/source3/lib/netapi/libnetapi.h
r740 r988 79 79 WERROR NetServerSetInfo_l(struct libnetapi_ctx *ctx, 80 80 struct NetServerSetInfo *r); 81 NET_API_STATUS NetWkstaGetInfo(const char * wksta_name /* [in] [unique] */, 82 uint32_t level /* [in] */, 83 uint8_t **buffer /* [out] [ref] */); 84 WERROR NetWkstaGetInfo_r(struct libnetapi_ctx *ctx, 85 struct NetWkstaGetInfo *r); 86 WERROR NetWkstaGetInfo_l(struct libnetapi_ctx *ctx, 87 struct NetWkstaGetInfo *r); 81 88 NET_API_STATUS NetGetDCName(const char * server_name /* [in] [unique] */, 82 89 const char * domain_name /* [in] [unique] */, -
vendor/current/source3/lib/netapi/localgroup.c
r860 r988 166 166 } 167 167 168 ZERO_STRUCT(connect_handle); 169 ZERO_STRUCT(builtin_handle); 170 ZERO_STRUCT(domain_handle); 171 ZERO_STRUCT(alias_handle); 172 168 173 switch (r->in.level) { 169 174 case 0: … … 180 185 } 181 186 182 ZERO_STRUCT(connect_handle);183 ZERO_STRUCT(builtin_handle);184 ZERO_STRUCT(domain_handle);185 ZERO_STRUCT(alias_handle);186 187 187 werr = libnetapi_open_pipe(ctx, r->in.server_name, 188 &ndr_table_samr .syntax_id,188 &ndr_table_samr, 189 189 &pipe_cli); 190 190 if (!W_ERROR_IS_OK(werr)) { … … 320 320 321 321 werr = libnetapi_open_pipe(ctx, r->in.server_name, 322 &ndr_table_samr .syntax_id,322 &ndr_table_samr, 323 323 &pipe_cli); 324 324 if (!W_ERROR_IS_OK(werr)) { … … 500 500 501 501 werr = libnetapi_open_pipe(ctx, r->in.server_name, 502 &ndr_table_samr .syntax_id,502 &ndr_table_samr, 503 503 &pipe_cli); 504 504 if (!W_ERROR_IS_OK(werr)) { … … 617 617 union samr_AliasInfo *info = NULL; 618 618 619 info = TALLOC_ZERO_P(mem_ctx, union samr_AliasInfo);619 info = talloc_zero(mem_ctx, union samr_AliasInfo); 620 620 W_ERROR_HAVE_NO_MEMORY(info); 621 621 … … 679 679 680 680 werr = libnetapi_open_pipe(ctx, r->in.server_name, 681 &ndr_table_samr .syntax_id,681 &ndr_table_samr, 682 682 &pipe_cli); 683 683 if (!W_ERROR_IS_OK(werr)) { … … 829 829 830 830 werr = libnetapi_open_pipe(ctx, r->in.server_name, 831 &ndr_table_samr .syntax_id,831 &ndr_table_samr, 832 832 &pipe_cli); 833 833 if (!W_ERROR_IS_OK(werr)) { … … 1122 1122 ZERO_STRUCT(alias_handle); 1123 1123 1124 member_sids = TALLOC_ZERO_ARRAY(ctx, struct dom_sid,1124 member_sids = talloc_zero_array(ctx, struct dom_sid, 1125 1125 r->in.total_entries); 1126 1126 W_ERROR_HAVE_NO_MEMORY(member_sids); … … 1142 1142 if (r->in.level == 3) { 1143 1143 werr = libnetapi_open_pipe(ctx, r->in.server_name, 1144 &ndr_table_lsarpc .syntax_id,1144 &ndr_table_lsarpc, 1145 1145 &lsa_pipe); 1146 1146 if (!W_ERROR_IS_OK(werr)) { … … 1161 1161 1162 1162 werr = libnetapi_open_pipe(ctx, r->in.server_name, 1163 &ndr_table_samr .syntax_id,1163 &ndr_table_samr, 1164 1164 &pipe_cli); 1165 1165 if (!W_ERROR_IS_OK(werr)) { -
vendor/current/source3/lib/netapi/netapi.c
r746 r988 25 25 26 26 struct libnetapi_ctx *stat_ctx = NULL; 27 TALLOC_CTX *frame = NULL;28 27 static bool libnetapi_initialized = false; 29 28 … … 39 38 } 40 39 41 priv = TALLOC_ZERO_P(ctx, struct libnetapi_private_ctx);40 priv = talloc_zero(ctx, struct libnetapi_private_ctx); 42 41 if (!priv) { 43 42 return W_ERROR_V(WERR_NOMEM); … … 58 57 NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) 59 58 { 59 NET_API_STATUS ret; 60 TALLOC_CTX *frame; 60 61 if (stat_ctx && libnetapi_initialized) { 61 62 *context = stat_ctx; … … 67 68 #endif 68 69 frame = talloc_stackframe(); 69 70 /* Case tables must be loaded before any string comparisons occour */71 load_case_tables_library();72 70 73 71 /* When libnetapi is invoked from an application, it does not … … 77 75 setup_logging("libnetapi", DEBUG_STDERR); 78 76 79 if (!lp_load (get_dyn_CONFIGFILE(), true, false, false, false)) {77 if (!lp_load_global(get_dyn_CONFIGFILE())) { 80 78 TALLOC_FREE(frame); 81 79 fprintf(stderr, "error loading %s\n", get_dyn_CONFIGFILE() ); … … 89 87 BlockSignals(True, SIGPIPE); 90 88 91 return libnetapi_net_init(context); 89 ret = libnetapi_net_init(context); 90 TALLOC_FREE(frame); 91 return ret; 92 92 } 93 93 … … 104 104 NET_API_STATUS status; 105 105 struct libnetapi_ctx *ctx = NULL; 106 107 frame = talloc_stackframe(); 106 TALLOC_CTX *frame = talloc_stackframe(); 108 107 109 108 ctx = talloc_zero(frame, struct libnetapi_ctx); … … 116 115 117 116 if (getenv("USER")) { 118 ctx->username = talloc_strdup( frame, getenv("USER"));117 ctx->username = talloc_strdup(ctx, getenv("USER")); 119 118 } else { 120 ctx->username = talloc_strdup( frame, "");119 ctx->username = talloc_strdup(ctx, ""); 121 120 } 122 121 if (!ctx->username) { … … 134 133 libnetapi_initialized = true; 135 134 135 talloc_steal(NULL, ctx); 136 136 *context = stat_ctx = ctx; 137 137 138 TALLOC_FREE(frame); 138 139 return NET_API_STATUS_SUCCESS; 139 140 } … … 159 160 NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) 160 161 { 162 TALLOC_CTX *frame; 163 161 164 if (!ctx) { 162 165 return NET_API_STATUS_SUCCESS; 163 166 } 164 167 168 frame = talloc_stackframe(); 165 169 libnetapi_samr_free(ctx); 166 170 … … 176 180 gfree_names(); 177 181 gfree_loadparm(); 178 gfree_case_tables();179 182 gfree_charcnv(); 180 183 gfree_interfaces(); … … 182 185 secrets_shutdown(); 183 186 187 if (ctx == stat_ctx) { 188 stat_ctx = NULL; 189 } 184 190 TALLOC_FREE(ctx); 185 TALLOC_FREE(frame);186 191 187 192 gfree_debugsyms(); 193 talloc_free(frame); 188 194 189 195 return NET_API_STATUS_SUCCESS; … … 197 203 const char *debuglevel) 198 204 { 205 TALLOC_CTX *frame = talloc_stackframe(); 199 206 ctx->debuglevel = talloc_strdup(ctx, debuglevel); 207 200 208 if (!lp_set_cmdline("log level", debuglevel)) { 209 TALLOC_FREE(frame); 201 210 return W_ERROR_V(WERR_GENERAL_FAILURE); 202 211 } 212 TALLOC_FREE(frame); 203 213 return NET_API_STATUS_SUCCESS; 204 214 } … … 270 280 271 281 /**************************************************************** 272 ****************************************************************/ 273 274 const char *libnetapi_errstr(NET_API_STATUS status) 275 { 282 Return a libnetapi error as a string, caller must free with NetApiBufferFree 283 ****************************************************************/ 284 285 char *libnetapi_errstr(NET_API_STATUS status) 286 { 287 TALLOC_CTX *frame = talloc_stackframe(); 288 char *ret; 276 289 if (status & 0xc0000000) { 277 return get_friendly_nt_error_msg(NT_STATUS(status)); 278 } 279 280 return get_friendly_werror_msg(W_ERROR(status)); 290 ret = talloc_strdup(NULL, 291 get_friendly_nt_error_msg(NT_STATUS(status))); 292 } else { 293 ret = talloc_strdup(NULL, 294 get_friendly_werror_msg(W_ERROR(status))); 295 } 296 TALLOC_FREE(frame); 297 return ret; 281 298 } 282 299 … … 302 319 303 320 /**************************************************************** 304 ****************************************************************/ 305 306 const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, 321 Return a libnetapi_errstr(), caller must free with NetApiBufferFree 322 ****************************************************************/ 323 324 char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, 307 325 NET_API_STATUS status_in) 308 326 { … … 318 336 319 337 if (tmp_ctx->error_string) { 320 return t mp_ctx->error_string;338 return talloc_strdup(NULL, tmp_ctx->error_string); 321 339 } 322 340 -
vendor/current/source3/lib/netapi/netapi.h
r740 r988 1234 1234 }; 1235 1235 1236 struct SHARE_INFO_502 { 1237 const char * shi502_netname; 1238 uint32_t shi502_type; 1239 const char * shi502_remark; 1240 uint32_t shi502_permissions; 1241 uint32_t shi502_max_uses; 1242 uint32_t shi502_current_uses; 1243 const char * shi502_path; 1244 const char * shi502_passwd; 1245 uint32_t shi502_reserved; 1246 struct security_descriptor * shi502_security_descriptor; 1247 }; 1248 1236 1249 struct SHARE_INFO_1004 { 1237 1250 const char * shi1004_remark; … … 1297 1310 #define DS_SELECT_SECRET_DOMAIN_6_FLAG ( 0x00000800 ) 1298 1311 #define DS_FULL_SECRET_DOMAIN_6_FLAG ( 0x00001000 ) 1312 #define DS_WS_FLAG ( 0x00002000 ) 1313 #define DS_DS_8_FLAG ( 0x00004000 ) 1299 1314 #define DS_DNS_CONTROLLER_FLAG ( 0x20000000 ) 1300 1315 #define DS_DNS_DOMAIN_FLAG ( 0x40000000 ) … … 1412 1427 1413 1428 /**************************************************************** 1429 Return a specific libnetapi error as a string, caller must free with NetApiBufferFree 1414 1430 ****************************************************************/ 1415 1431 1416 c onst char *libnetapi_errstr(NET_API_STATUS status);1432 char *libnetapi_errstr(NET_API_STATUS status); 1417 1433 1418 1434 /**************************************************************** 1435 Return the last libnetapi error as a string, caller must free with NetApiBufferFree 1436 ctx is optional 1419 1437 ****************************************************************/ 1420 1438 1421 c onst char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,1422 1439 char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, 1440 NET_API_STATUS status); 1423 1441 1424 1442 /**************************************************************** … … 1612 1630 uint8_t *buffer /* [in] [ref] */, 1613 1631 uint32_t *parm_error /* [out] [ref] */); 1632 1633 /************************************************************//** 1634 * 1635 * NetWkstaGetInfo 1636 * 1637 * @brief Get Information on a workstation 1638 * 1639 * @param[in] wksta_name The workstation name to connect to 1640 * @param[in] level The level to define which information is requested 1641 * @param[out] buffer The returned buffer carrying the WKSTA_INFO structure 1642 * @return NET_API_STATUS 1643 * 1644 ***************************************************************/ 1645 1646 NET_API_STATUS NetWkstaGetInfo(const char * wksta_name /* [in] */, 1647 uint32_t level /* [in] */, 1648 uint8_t **buffer /* [out] [ref] */); 1614 1649 1615 1650 /************************************************************//** -
vendor/current/source3/lib/netapi/netapi_private.h
r740 r988 31 31 32 32 struct dcerpc_binding_handle; 33 struct ndr_interface_table; 33 34 34 35 struct libnetapi_private_ctx { … … 61 62 WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx, 62 63 const char *server_name, 63 const struct ndr_ syntax_id *interface,64 const struct ndr_interface_table *table, 64 65 struct rpc_pipe_client **presult); 65 66 WERROR libnetapi_get_binding_handle(struct libnetapi_ctx *ctx, 66 67 const char *server_name, 67 const struct ndr_ syntax_id *interface,68 const struct ndr_interface_table *table, 68 69 struct dcerpc_binding_handle **binding_handle); 69 70 WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx, -
vendor/current/source3/lib/netapi/netlogon.c
r740 r988 134 134 135 135 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 136 &ndr_table_netlogon .syntax_id,136 &ndr_table_netlogon, 137 137 &b); 138 138 if (!W_ERROR_IS_OK(werr)) { … … 191 191 192 192 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 193 &ndr_table_netlogon .syntax_id,193 &ndr_table_netlogon, 194 194 &b); 195 195 if (!W_ERROR_IS_OK(werr)) { -
vendor/current/source3/lib/netapi/samr.c
r740 r988 46 46 const char *domain_name = NULL; 47 47 struct lsa_String lsa_domain_name; 48 bool domain_found = true;48 bool domain_found = false; 49 49 int i; 50 50 struct dcerpc_binding_handle *b = pipe_cli->binding_handle; … … 241 241 connect_handle, 242 242 builtin_mask, 243 CONST_DISCARD(struct dom_sid *, &global_sid_Builtin),243 discard_const_p(struct dom_sid, &global_sid_Builtin), 244 244 builtin_handle, 245 245 &result); … … 284 284 struct libnetapi_private_ctx); 285 285 286 if (! policy_handle_equal(handle, &priv->samr.domain_handle)) {286 if (!ndr_policy_handle_equal(handle, &priv->samr.domain_handle)) { 287 287 return; 288 288 } … … 312 312 struct libnetapi_private_ctx); 313 313 314 if (! policy_handle_equal(handle, &priv->samr.builtin_handle)) {314 if (!ndr_policy_handle_equal(handle, &priv->samr.builtin_handle)) { 315 315 return; 316 316 } … … 340 340 struct libnetapi_private_ctx); 341 341 342 if (! policy_handle_equal(handle, &priv->samr.connect_handle)) {342 if (!ndr_policy_handle_equal(handle, &priv->samr.connect_handle)) { 343 343 return; 344 344 } -
vendor/current/source3/lib/netapi/serverinfo.c
r740 r988 37 37 38 38 i.sv101_platform_id = PLATFORM_ID_NT; 39 i.sv101_name = global_myname();40 i.sv101_version_major = lp_major_announce_version();41 i.sv101_version_minor = lp_minor_announce_version();39 i.sv101_name = lp_netbios_name(); 40 i.sv101_version_major = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION; 41 i.sv101_version_minor = SAMBA_MINOR_NBT_ANNOUNCE_VERSION; 42 42 i.sv101_type = lp_default_server_announce(); 43 i.sv101_comment = lp_server string();43 i.sv101_comment = lp_server_string(ctx); 44 44 45 45 *buffer = (uint8_t *)talloc_memdup(ctx, &i, sizeof(i)); … … 59 59 struct SERVER_INFO_1005 info1005; 60 60 61 info1005.sv1005_comment = lp_server string();61 info1005.sv1005_comment = lp_server_string(ctx); 62 62 *buffer = (uint8_t *)talloc_memdup(ctx, &info1005, sizeof(info1005)); 63 63 if (!*buffer) { … … 504 504 505 505 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 506 &ndr_table_srvsvc .syntax_id,506 &ndr_table_srvsvc, 507 507 &b); 508 508 if (!W_ERROR_IS_OK(werr)) { … … 617 617 618 618 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 619 &ndr_table_srvsvc .syntax_id,619 &ndr_table_srvsvc, 620 620 &b); 621 621 if (!W_ERROR_IS_OK(werr)) { … … 659 659 660 660 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 661 &ndr_table_srvsvc .syntax_id,661 &ndr_table_srvsvc, 662 662 &b); 663 663 if (!W_ERROR_IS_OK(werr)) { -
vendor/current/source3/lib/netapi/share.c
r740 r988 25 25 #include "lib/netapi/libnetapi.h" 26 26 #include "../librpc/gen_ndr/ndr_srvsvc_c.h" 27 #include "librpc/gen_ndr/ndr_security.h" 27 28 28 29 /**************************************************************** … … 130 131 { 131 132 struct SHARE_INFO_2 *i2 = NULL; 133 struct SHARE_INFO_502 *i502 = NULL; 132 134 struct SHARE_INFO_1004 *i1004 = NULL; 133 135 struct srvsvc_NetShareInfo2 *s2 = NULL; 136 struct srvsvc_NetShareInfo502 *s502 = NULL; 134 137 struct srvsvc_NetShareInfo1004 *s1004 = NULL; 135 138 … … 142 145 i2 = (struct SHARE_INFO_2 *)buffer; 143 146 144 s2 = TALLOC_P(mem_ctx, struct srvsvc_NetShareInfo2);147 s2 = talloc(mem_ctx, struct srvsvc_NetShareInfo2); 145 148 NT_STATUS_HAVE_NO_MEMORY(s2); 146 149 … … 157 160 158 161 break; 162 163 case 502: 164 i502 = (struct SHARE_INFO_502 *)buffer; 165 166 s502 = talloc(mem_ctx, struct srvsvc_NetShareInfo502); 167 NT_STATUS_HAVE_NO_MEMORY(s502); 168 169 s502->name = i502->shi502_netname; 170 s502->type = i502->shi502_type; 171 s502->comment = i502->shi502_remark; 172 s502->permissions = i502->shi502_permissions; 173 s502->max_users = i502->shi502_max_uses; 174 s502->current_users = i502->shi502_current_uses; 175 s502->path = i502->shi502_path; 176 s502->password = i502->shi502_passwd; 177 s502->sd_buf.sd_size = 178 ndr_size_security_descriptor(i502->shi502_security_descriptor, 0); 179 s502->sd_buf.sd = i502->shi502_security_descriptor; 180 181 info->info502 = s502; 182 183 break; 184 159 185 case 1004: 160 186 i1004 = (struct SHARE_INFO_1004 *)buffer; 161 187 162 s1004 = TALLOC_P(mem_ctx, struct srvsvc_NetShareInfo1004);188 s1004 = talloc(mem_ctx, struct srvsvc_NetShareInfo1004); 163 189 NT_STATUS_HAVE_NO_MEMORY(s1004); 164 190 … … 192 218 switch (r->in.level) { 193 219 case 2: 194 break;195 220 case 502: 221 break; 196 222 case 503: 197 223 return WERR_NOT_SUPPORTED; … … 201 227 202 228 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 203 &ndr_table_srvsvc .syntax_id,229 &ndr_table_srvsvc, 204 230 &b); 205 231 if (!W_ERROR_IS_OK(werr)) { … … 259 285 260 286 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 261 &ndr_table_srvsvc .syntax_id,287 &ndr_table_srvsvc, 262 288 &b); 263 289 if (!W_ERROR_IS_OK(werr)) { … … 322 348 323 349 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 324 &ndr_table_srvsvc .syntax_id,350 &ndr_table_srvsvc, 325 351 &b); 326 352 if (!W_ERROR_IS_OK(werr)) { … … 361 387 362 388 for (i=0; i < info_ctr.ctr.ctr1->count; i++) { 363 union srvsvc_NetShareInfo _i ;389 union srvsvc_NetShareInfo _i = {0}; 364 390 switch (r->in.level) { 365 391 case 0: … … 429 455 430 456 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 431 &ndr_table_srvsvc .syntax_id,457 &ndr_table_srvsvc, 432 458 &b); 433 459 if (!W_ERROR_IS_OK(werr)) { … … 503 529 504 530 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 505 &ndr_table_srvsvc .syntax_id,531 &ndr_table_srvsvc, 506 532 &b); 507 533 if (!W_ERROR_IS_OK(werr)) { -
vendor/current/source3/lib/netapi/shutdown.c
r740 r988 39 39 40 40 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 41 &ndr_table_initshutdown .syntax_id,41 &ndr_table_initshutdown, 42 42 &b); 43 43 if (!W_ERROR_IS_OK(werr)) { … … 83 83 84 84 werr = libnetapi_get_binding_handle(ctx, r->in.server_name, 85 &ndr_table_initshutdown .syntax_id,85 &ndr_table_initshutdown, 86 86 &b); 87 87 if (!W_ERROR_IS_OK(werr)) { -
vendor/current/source3/lib/netapi/tests/common.h
r414 r988 29 29 #define POPT_COMMON_LIBNETAPI_EXAMPLES { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_netapi_examples, 0, "Common samba netapi example options:", NULL }, 30 30 31 #ifndef POPT_TABLEEND 32 #define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL } 33 #endif 34 31 35 NET_API_STATUS test_netuseradd(const char *hostname, 32 36 const char *username); … … 46 50 NET_API_STATUS netapitest_server(struct libnetapi_ctx *ctx, 47 51 const char *hostname); 52 NET_API_STATUS netapitest_wksta(struct libnetapi_ctx *ctx, 53 const char *hostname); 48 54 49 55 #ifndef ARRAY_SIZE -
vendor/current/source3/lib/netapi/tests/netapitest.c
r414 r988 95 95 } 96 96 97 status = netapitest_wksta(ctx, hostname); 98 if (status) { 99 goto out; 100 } 101 97 102 out: 98 103 if (status != 0) { -
vendor/current/source3/lib/netapi/tests/netgroup.c
r414 r988 52 52 level, 53 53 &buffer, 54 120, / /(uint32_t)-1,54 120, /*(uint32_t)-1, */ 55 55 &entries_read, 56 56 &total_entries, … … 349 349 350 350 status = NetGroupSetInfo(hostname, groupname, 0, (uint8_t *)&g0, &parm_err); 351 switch ( status) {351 switch ((int)status) { 352 352 case 0: 353 353 break; -
vendor/current/source3/lib/netapi/tests/netshare.c
r414 r988 125 125 uint8_t *buffer = NULL; 126 126 struct SHARE_INFO_2 i2; 127 struct SHARE_INFO_502 i502; 127 128 struct SHARE_INFO_1004 i1004; 128 129 struct SHARE_INFO_501 *i501 = NULL; … … 143 144 printf("testing NetShareAdd\n"); 144 145 146 ZERO_STRUCT(i502); 147 148 i502.shi502_netname = sharename; 149 i502.shi502_path = "c:\\"; 150 151 status = NetShareAdd(hostname, 502, (uint8_t *)&i502, &parm_err); 152 if (status) { 153 NETAPI_STATUS(ctx, status, "NetShareAdd"); 154 goto out; 155 }; 156 157 status = NetShareDel(hostname, sharename, 0); 158 if (status) { 159 NETAPI_STATUS(ctx, status, "NetShareDel"); 160 goto out; 161 }; 162 145 163 ZERO_STRUCT(i2); 146 164 -
vendor/current/source3/lib/netapi/tests/netuser.c
r414 r988 58 58 FILTER_NORMAL_ACCOUNT, 59 59 &buffer, 60 120, / /(uint32_t)-1,60 120, /*(uint32_t)-1, */ 61 61 &entries_read, 62 62 &total_entries, … … 276 276 level, 277 277 &buffer, 278 120, / /(uint32_t)-1,278 120, /*(uint32_t)-1, */ 279 279 &entries_read, 280 280 &total_entries); -
vendor/current/source3/lib/netapi/user.c
r860 r988 69 69 } 70 70 if (infoX->usriX_password_age) { 71 fields_present |= SAMR_FIELD_ FORCE_PWD_CHANGE;71 fields_present |= SAMR_FIELD_EXPIRED_FLAG; 72 72 } 73 73 if (infoX->usriX_full_name) { … … 401 401 402 402 werr = libnetapi_open_pipe(ctx, r->in.server_name, 403 &ndr_table_samr .syntax_id,403 &ndr_table_samr, 404 404 &pipe_cli); 405 405 if (!W_ERROR_IS_OK(werr)) { … … 553 553 554 554 werr = libnetapi_open_pipe(ctx, r->in.server_name, 555 &ndr_table_samr .syntax_id,555 &ndr_table_samr, 556 556 &pipe_cli); 557 557 … … 576 576 &connect_handle, 577 577 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT, 578 CONST_DISCARD(struct dom_sid *, &global_sid_Builtin),578 discard_const_p(struct dom_sid, &global_sid_Builtin), 579 579 &builtin_handle, 580 580 &result); … … 1202 1202 1203 1203 switch (level) { 1204 case 0:1205 /* already returned above */1206 break;1207 1204 case 1: 1208 1205 status = info21_to_USER_INFO_1(mem_ctx, info21, &info1); … … 1323 1320 1324 1321 werr = libnetapi_open_pipe(ctx, r->in.server_name, 1325 &ndr_table_samr .syntax_id,1322 &ndr_table_samr, 1326 1323 &pipe_cli); 1327 1324 if (!W_ERROR_IS_OK(werr)) { … … 1445 1442 int i; 1446 1443 1447 user = TALLOC_ZERO_ARRAY(mem_ctx,1444 user = talloc_zero_array(mem_ctx, 1448 1445 struct NET_DISPLAY_USER, 1449 1446 info->count); … … 1489 1486 int i; 1490 1487 1491 machine = TALLOC_ZERO_ARRAY(mem_ctx,1488 machine = talloc_zero_array(mem_ctx, 1492 1489 struct NET_DISPLAY_MACHINE, 1493 1490 info->count); … … 1531 1528 int i; 1532 1529 1533 group = TALLOC_ZERO_ARRAY(mem_ctx,1530 group = talloc_zero_array(mem_ctx, 1534 1531 struct NET_DISPLAY_GROUP, 1535 1532 info->count); … … 1631 1628 1632 1629 werr = libnetapi_open_pipe(ctx, r->in.server_name, 1633 &ndr_table_samr .syntax_id,1630 &ndr_table_samr, 1634 1631 &pipe_cli); 1635 1632 if (!W_ERROR_IS_OK(werr)) { … … 1765 1762 1766 1763 werr = libnetapi_open_pipe(ctx, r->in.server_name, 1767 &ndr_table_samr .syntax_id,1764 &ndr_table_samr, 1768 1765 &pipe_cli); 1769 1766 if (!W_ERROR_IS_OK(werr)) { … … 1905 1902 case 1024: 1906 1903 user_mask = SAMR_USER_ACCESS_SET_LOC_COM; 1904 break; 1907 1905 case 1051: 1908 1906 user_mask = SAMR_USER_ACCESS_SET_ATTRIBUTES | … … 1936 1934 1937 1935 werr = libnetapi_open_pipe(ctx, r->in.server_name, 1938 &ndr_table_samr .syntax_id,1936 &ndr_table_samr, 1939 1937 &pipe_cli); 1940 1938 if (!W_ERROR_IS_OK(werr)) { … … 2395 2393 2396 2394 werr = libnetapi_open_pipe(ctx, r->in.server_name, 2397 &ndr_table_samr .syntax_id,2395 &ndr_table_samr, 2398 2396 &pipe_cli); 2399 2397 if (!W_ERROR_IS_OK(werr)) { … … 2880 2878 2881 2879 werr = libnetapi_open_pipe(ctx, r->in.server_name, 2882 &ndr_table_samr .syntax_id,2880 &ndr_table_samr, 2883 2881 &pipe_cli); 2884 2882 if (!W_ERROR_IS_OK(werr)) { … … 3015 3013 3016 3014 werr = libnetapi_open_pipe(ctx, r->in.server_name, 3017 &ndr_table_samr .syntax_id,3015 &ndr_table_samr, 3018 3016 &pipe_cli); 3019 3017 if (!W_ERROR_IS_OK(werr)) { … … 3178 3176 3179 3177 uint32_t *member_rids = NULL; 3180 size_t num_member_rids = 0;3181 3178 3182 3179 struct GROUP_USERS_INFO_0 *i0 = NULL; … … 3192 3189 ZERO_STRUCT(connect_handle); 3193 3190 ZERO_STRUCT(domain_handle); 3191 ZERO_STRUCT(group_handle); 3194 3192 3195 3193 if (!r->in.buffer) { … … 3206 3204 3207 3205 werr = libnetapi_open_pipe(ctx, r->in.server_name, 3208 &ndr_table_samr .syntax_id,3206 &ndr_table_samr, 3209 3207 &pipe_cli); 3210 3208 if (!W_ERROR_IS_OK(werr)) { … … 3320 3318 3321 3319 member_rids = group_rids.ids; 3322 num_member_rids = group_rids.count;3323 3320 3324 3321 status = dcerpc_samr_GetGroupsForUser(b, talloc_tos(), … … 3548 3545 3549 3546 werr = libnetapi_open_pipe(ctx, r->in.server_name, 3550 &ndr_table_samr .syntax_id,3547 &ndr_table_samr, 3551 3548 &pipe_cli); 3552 3549 if (!W_ERROR_IS_OK(werr)) { … … 3639 3636 3640 3637 sid_array.num_sids = rid_array->count + 1; 3641 sid_array.sids = TALLOC_ARRAY(ctx, struct lsa_SidPtr, sid_array.num_sids);3638 sid_array.sids = talloc_array(ctx, struct lsa_SidPtr, sid_array.num_sids); 3642 3639 if (!sid_array.sids) { 3643 3640 werr = WERR_NOMEM;
Note:
See TracChangeset
for help on using the changeset viewer.