Changeset 745 for trunk/server/source4/libnet/libnet_site.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source4/libnet/libnet_site.c
r414 r745 21 21 #include "libnet/libnet.h" 22 22 #include "libcli/cldap/cldap.h" 23 #include "lib/ldb/include/ldb.h" 24 #include "lib/ldb/include/ldb_errors.h" 25 #include "librpc/rpc/dcerpc.h" 23 #include <ldb.h> 24 #include <ldb_errors.h> 26 25 #include "libcli/resolve/resolve.h" 27 26 #include "param/param.h" 27 #include "lib/tsocket/tsocket.h" 28 28 29 29 /** … … 42 42 struct cldap_socket *cldap = NULL; 43 43 struct cldap_netlogon search; 44 int ret; 45 struct tsocket_address *dest_address; 44 46 45 47 tmp_ctx = talloc_named(ctx, 0, "libnet_FindSite temp context"); … … 51 53 /* Resolve the site name. */ 52 54 ZERO_STRUCT(search); 53 search.in.dest_address = r->in.dest_address;54 search.in.dest_port = r->in.cldap_port;55 search.in.dest_address = NULL; 56 search.in.dest_port = 0; 55 57 search.in.acct_control = -1; 56 58 search.in.version = NETLOGON_NT_VERSION_5 | NETLOGON_NT_VERSION_5EX; 57 59 search.in.map_response = true; 58 60 61 ret = tsocket_address_inet_from_strings(tmp_ctx, "ip", 62 r->in.dest_address, 63 r->in.cldap_port, 64 &dest_address); 65 if (ret != 0) { 66 r->out.error_string = NULL; 67 status = map_nt_error_from_unix(errno); 68 return status; 69 } 70 59 71 /* we want to use non async calls, so we're not passing an event context */ 60 status = cldap_socket_init(tmp_ctx, NULL, NULL, NULL, &cldap);//TODO72 status = cldap_socket_init(tmp_ctx, NULL, NULL, dest_address, &cldap); 61 73 if (!NT_STATUS_IS_OK(status)) { 62 74 talloc_free(tmp_ctx); … … 64 76 return status; 65 77 } 66 status = cldap_netlogon(cldap, lp_iconv_convenience(lctx->lp_ctx),tmp_ctx, &search);78 status = cldap_netlogon(cldap, tmp_ctx, &search); 67 79 if (!NT_STATUS_IS_OK(status) 68 80 || !search.out.netlogon.data.nt5_ex.client_site) { … … 157 169 158 170 make_nbt_name_client(&name, libnet_r->out.samr_binding->host); 159 status = resolve_name(lp _resolve_context(ctx->lp_ctx), &name, r, &dest_addr, ctx->event_ctx);171 status = resolve_name(lpcfg_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, ctx->event_ctx); 160 172 if (!NT_STATUS_IS_OK(status)) { 161 173 libnet_r->out.error_string = NULL; … … 168 180 r->in.netbios_name = libnet_r->in.netbios_name; 169 181 r->in.domain_dn_str = libnet_r->out.domain_dn_str; 170 r->in.cldap_port = lp _cldap_port(ctx->lp_ctx);182 r->in.cldap_port = lpcfg_cldap_port(ctx->lp_ctx); 171 183 172 184 status = libnet_FindSite(tmp_ctx, ctx, r); … … 192 204 193 205 rtn = ldb_msg_add_string(msg, "objectClass", "server"); 194 if (rtn != 0) {206 if (rtn != LDB_SUCCESS) { 195 207 libnet_r->out.error_string = NULL; 196 208 talloc_free(tmp_ctx); … … 198 210 } 199 211 rtn = ldb_msg_add_string(msg, "systemFlags", "50000000"); 200 if (rtn != 0) {212 if (rtn != LDB_SUCCESS) { 201 213 libnet_r->out.error_string = NULL; 202 214 talloc_free(tmp_ctx); … … 204 216 } 205 217 rtn = ldb_msg_add_string(msg, "serverReference", libnet_r->out.account_dn_str); 206 if (rtn != 0) {218 if (rtn != LDB_SUCCESS) { 207 219 libnet_r->out.error_string = NULL; 208 220 talloc_free(tmp_ctx); … … 223 235 rtn = ldb_add(remote_ldb, msg); 224 236 if (rtn == LDB_ERR_ENTRY_ALREADY_EXISTS) { 225 int i;237 unsigned int i; 226 238 227 239 /* make a 'modify' msg, and only for serverReference */ … … 235 247 236 248 rtn = ldb_msg_add_string(msg, "serverReference",libnet_r->out.account_dn_str); 237 if (rtn != 0) {249 if (rtn != LDB_SUCCESS) { 238 250 libnet_r->out.error_string = NULL; 239 251 talloc_free(tmp_ctx); … … 248 260 249 261 rtn = ldb_modify(remote_ldb, msg); 250 if (rtn != 0) {262 if (rtn != LDB_SUCCESS) { 251 263 libnet_r->out.error_string 252 264 = talloc_asprintf(libnet_r, … … 257 269 return NT_STATUS_INTERNAL_DB_CORRUPTION; 258 270 } 259 } else if (rtn != 0) {271 } else if (rtn != LDB_SUCCESS) { 260 272 libnet_r->out.error_string 261 273 = talloc_asprintf(libnet_r,
Note:
See TracChangeset
for help on using the changeset viewer.