This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "lib/ldb/include/ldb.h"
#include "dsdb/samdb/samdb.h"
#include "auth/auth.h"
-#include "db_wrap.h"
+#include "util/util_ldb.h"
#include "librpc/gen_ndr/ndr_nbt.h"
+#include "param/param.h"
/*
reply to a GETDC request
struct nbt_netlogon_packet *netlogon)
{
struct nbt_name *name = &packet->data.msg.dest_name;
- struct nbtd_interface *reply_iface = nbtd_find_reply_iface(iface, src->addr, False);
+ struct nbtd_interface *reply_iface = nbtd_find_reply_iface(iface, src->addr, false);
struct nbt_netlogon_packet reply;
struct nbt_netlogon_response_from_pdc *pdc;
const char *ref_attrs[] = {"nETBIOSName", NULL};
struct ldb_message **ref_res;
struct ldb_context *samctx;
+ struct ldb_dn *partitions_basedn;
int ret;
/* only answer getdc requests on the PDC or LOGON names */
return;
}
- samctx = samdb_connect(packet, anonymous_session(packet));
+ samctx = samdb_connect(packet, global_loadparm, anonymous_session(packet));
if (samctx == NULL) {
DEBUG(2,("Unable to open sam in getdc reply\n"));
return;
}
- ret = gendb_search(samctx, samctx, NULL, &ref_res, ref_attrs,
+ partitions_basedn = samdb_partitions_dn(samctx, packet);
+
+ ret = gendb_search(samctx, packet, partitions_basedn, &ref_res, ref_attrs,
"(&(&(nETBIOSName=%s)(objectclass=crossRef))(ncName=*))",
name->name);
reply.command = NETLOGON_RESPONSE_FROM_PDC;
pdc = &reply.req.response;
- pdc->pdc_name = lp_netbios_name();
+ pdc->pdc_name = lp_netbios_name(global_loadparm);
pdc->unicode_pdc_name = pdc->pdc_name;
pdc->domain_name = samdb_result_string(ref_res[0], "nETBIOSName", name->name);;
pdc->nt_version = 1;
struct nbt_netlogon_packet *netlogon)
{
struct nbt_name *name = &packet->data.msg.dest_name;
- struct nbtd_interface *reply_iface = nbtd_find_reply_iface(iface, src->addr, False);
+ struct nbtd_interface *reply_iface = nbtd_find_reply_iface(iface, src->addr, false);
struct nbt_netlogon_packet reply;
struct nbt_netlogon_response_from_pdc2 *pdc;
struct ldb_context *samctx;
const char *dom_attrs[] = {"objectGUID", NULL};
struct ldb_message **ref_res, **dom_res;
int ret;
- const char **services = lp_server_services();
+ const char **services = lp_server_services(global_loadparm);
const char *my_ip = reply_iface->ip_address;
- const struct ldb_dn *partitions_basedn = ldb_dn_string_compose(packet, samdb_base_dn(packet), "CN=Partitions,CN=Configuration");
+ struct ldb_dn *partitions_basedn;
if (!my_ip) {
DEBUG(0, ("Could not obtain own IP address for datagram socket\n"));
return;
return;
}
- samctx = samdb_connect(packet, anonymous_session(packet));
+ samctx = samdb_connect(packet, global_loadparm, anonymous_session(packet));
if (samctx == NULL) {
DEBUG(2,("Unable to open sam in getdc reply\n"));
return;
}
- ret = gendb_search(samctx, samctx, partitions_basedn, &ref_res, ref_attrs,
+ partitions_basedn = samdb_partitions_dn(samctx, packet);
+
+ ret = gendb_search(samctx, packet, partitions_basedn, &ref_res, ref_attrs,
"(&(&(nETBIOSName=%s)(objectclass=crossRef))(ncName=*))",
name->name);
}
/* try and find the domain */
- ret = gendb_search_dn(samctx, samctx,
- samdb_result_dn(samctx, ref_res[0], "ncName", NULL),
+ ret = gendb_search_dn(samctx, packet,
+ samdb_result_dn(samctx, samctx, ref_res[0], "ncName", NULL),
&dom_res, dom_attrs);
if (ret != 1) {
DEBUG(2,("Unable to find domain from reference '%s' in sam\n",
- ldb_dn_linearize(samctx, ref_res[0]->dn)));
+ ldb_dn_get_linearized(ref_res[0]->dn)));
return;
}
}
pdc->domain_uuid = samdb_result_guid(dom_res[0], "objectGUID");
- pdc->forest = samdb_result_string(ref_res[0], "dnsRoot", lp_realm());
- pdc->dns_domain = samdb_result_string(ref_res[0], "dnsRoot", lp_realm());
+ pdc->forest = samdb_result_string(ref_res[0], "dnsRoot",
+ lp_realm(global_loadparm));
+ pdc->dns_domain = samdb_result_string(ref_res[0], "dnsRoot",
+ lp_realm(global_loadparm));
/* TODO: get our full DNS name from somewhere else */
pdc->pdc_dns_name = talloc_asprintf(packet, "%s.%s",
- strlower_talloc(packet, lp_netbios_name()),
+ strlower_talloc(packet,
+ lp_netbios_name(global_loadparm)),
pdc->dns_domain);
pdc->domain = samdb_result_string(ref_res[0], "nETBIOSName", name->name);;
- pdc->pdc_name = lp_netbios_name();
+ pdc->pdc_name = lp_netbios_name(global_loadparm);
pdc->user_name = netlogon->req.pdc2.user_name;
/* TODO: we need to make sure these are in our DNS zone */
- pdc->site_name = "Default-First-Site-Name";
- pdc->site_name2 = "Default-First-Site-Name";
+ pdc->server_site = "Default-First-Site-Name";
+ pdc->client_site = "Default-First-Site-Name";
pdc->unknown = 0x10; /* what is this? */
pdc->unknown2 = 2; /* and this ... */
pdc->pdc_ip = my_ip;