r25026: Move param/param.h out of includes.h
[kai/samba.git] / source4 / rpc_server / netlogon / dcerpc_netlogon.c
index b1d129e782af68c18dddacf98da258a434d4a49b..14a724a6f681620470d64ca16054d33076110053 100644 (file)
@@ -8,7 +8,7 @@
    
    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,
@@ -17,8 +17,7 @@
    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"
@@ -33,6 +32,7 @@
 #include "libcli/auth/libcli_auth.h"
 #include "auth/gensec/schannel_state.h"
 #include "libcli/security/security.h"
+#include "param/param.h"
 
 struct server_pipe_state {
        struct netr_Credential client_challenge;
@@ -80,7 +80,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca
        int num_records;
        struct ldb_message **msgs;
        NTSTATUS nt_status;
-       const char *attrs[] = {"ntPwdHash", "userAccountControl", 
+       const char *attrs[] = {"unicodePwd", "userAccountControl", 
                               "objectSid", NULL};
 
        ZERO_STRUCTP(r->out.credentials);
@@ -144,7 +144,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca
        *r->out.rid = samdb_result_rid_from_sid(mem_ctx, msgs[0], 
                                                "objectSid", 0);
 
-       mach_pwd = samdb_result_hash(mem_ctx, msgs[0], "ntPwdHash");
+       mach_pwd = samdb_result_hash(mem_ctx, msgs[0], "unicodePwd");
        if (mach_pwd == NULL) {
                return NT_STATUS_ACCESS_DENIED;
        }
@@ -313,7 +313,6 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet(struct dcesrv_call_state *dce_call
                                           NULL, /* Don't have plaintext */
                                           NULL, &r->in.new_password,
                                           False, /* This is not considered a password change */
-                                          False, /* don't restrict this password change (match w2k3) */
                                           NULL, NULL);
        return nt_status;
 }
@@ -361,7 +360,6 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal
                                           new_pass, /* we have plaintext */
                                           NULL, NULL,
                                           False, /* This is not considered a password change */
-                                          False, /* don't restrict this password change (match w2k3) */
                                           NULL, NULL);
        return nt_status;
 }
@@ -431,7 +429,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogon_base(struct dcesrv_call_state *dce_cal
                }
 
                /* TODO: we need to deny anonymous access here */
-               nt_status = auth_context_create(mem_ctx, lp_auth_methods(),
+               nt_status = auth_context_create(mem_ctx, 
                                                dce_call->event_ctx, dce_call->msg_ctx,
                                                &auth_context);
                NT_STATUS_NOT_OK_RETURN(nt_status);
@@ -457,7 +455,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogon_base(struct dcesrv_call_state *dce_cal
        case 6:
 
                /* TODO: we need to deny anonymous access here */
-               nt_status = auth_context_create(mem_ctx, lp_auth_methods(),
+               nt_status = auth_context_create(mem_ctx, 
                                                dce_call->event_ctx, dce_call->msg_ctx,
                                                &auth_context);
                NT_STATUS_NOT_OK_RETURN(nt_status);
@@ -692,7 +690,7 @@ static NTSTATUS dcesrv_netr_AccountSync(struct dcesrv_call_state *dce_call, TALL
 /* 
   netr_GetDcName 
 */
-static NTSTATUS dcesrv_netr_GetDcName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+static WERROR dcesrv_netr_GetDcName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                       struct netr_GetDcName *r)
 {
        DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
@@ -1010,11 +1008,21 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA
        W_ERROR_HAVE_NO_MEMORY(r->out.info->dc_unc);
        r->out.info->dc_address         = talloc_strdup(mem_ctx, "\\\\0.0.0.0");
        W_ERROR_HAVE_NO_MEMORY(r->out.info->dc_address);
-       r->out.info->dc_address_type    = 1;
+       r->out.info->dc_address_type    = DS_ADDRESS_TYPE_INET;
        r->out.info->domain_guid        = samdb_result_guid(res[0], "objectGUID");
        r->out.info->domain_name        = samdb_result_string(res[0], "dnsDomain", NULL);
        r->out.info->forest_name        = samdb_result_string(res[0], "dnsDomain", NULL);
-       r->out.info->dc_flags           = 0xE00001FD;
+       r->out.info->dc_flags           = DS_DNS_FOREST |
+                                         DS_DNS_DOMAIN |
+                                         DS_DNS_CONTROLLER |
+                                         DS_SERVER_WRITABLE |
+                                         DS_SERVER_CLOSEST |
+                                         DS_SERVER_TIMESERV |
+                                         DS_SERVER_KDC |
+                                         DS_SERVER_DS |
+                                         DS_SERVER_LDAP |
+                                         DS_SERVER_GC |
+                                         DS_SERVER_PDC;
        r->out.info->dc_site_name       = talloc_strdup(mem_ctx, "Default-First-Site-Name");
        W_ERROR_HAVE_NO_MEMORY(r->out.info->dc_site_name);
        r->out.info->client_site_name   = talloc_strdup(mem_ctx, "Default-First-Site-Name");
@@ -1109,10 +1117,10 @@ static WERROR dcesrv_netr_DSRADDRESSTOSITENAMESEXW(struct dcesrv_call_state *dce
 
 
 /* 
-  netr_DSRGETDCSITECOVERAGEW 
+  netr_DsrGetDcSiteCoverageW
 */
-static WERROR dcesrv_netr_DSRGETDCSITECOVERAGEW(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
-                      struct netr_DSRGETDCSITECOVERAGEW *r)
+static WERROR dcesrv_netr_DsrGetDcSiteCoverageW(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+                      struct netr_DsrGetDcSiteCoverageW *r)
 {
        DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 }
@@ -1204,10 +1212,10 @@ static WERROR dcesrv_netr_NETRSERVERTRUSTPASSWORDSGET(struct dcesrv_call_state *
 
 
 /* 
-  netr_DSRGETFORESTTRUSTINFORMATION 
+  netr_DsRGetForestTrustInformation 
 */
-static WERROR dcesrv_netr_DSRGETFORESTTRUSTINFORMATION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
-                      struct netr_DSRGETFORESTTRUSTINFORMATION *r)
+static WERROR dcesrv_netr_DsRGetForestTrustInformation(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+                      struct netr_DsRGetForestTrustInformation *r)
 {
        DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 }