r10508: - implement WINBINDD_NETBIOS_NAME, WINBINDD_DOMAIN_NAME and WINBINDD_INFO
authorStefan Metzmacher <metze@samba.org>
Mon, 26 Sep 2005 13:42:42 +0000 (13:42 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:38:58 +0000 (13:38 -0500)
is there a way to test this calls?

vl: please review this

metze

source/winbind/wb_samba3_cmd.c
source/winbind/wb_samba3_protocol.c
source/winbind/wb_samba3_protocol.h

index 01f284d72cc5a2953244f87e966decf2d1287b22..752a368d31f0da3f33c425f4314a2a81fcabda15 100644 (file)
@@ -30,6 +30,7 @@
 #include "librpc/gen_ndr/nbt.h"
 #include "libcli/raw/libcliraw.h"
 #include "libcli/composite/composite.h"
+#include "include/version.h"
 
 NTSTATUS wbsrv_samba3_interface_version(struct wbsrv_samba3_call *s3call)
 {
@@ -38,6 +39,28 @@ NTSTATUS wbsrv_samba3_interface_version(struct wbsrv_samba3_call *s3call)
        return NT_STATUS_OK;
 }
 
+NTSTATUS wbsrv_samba3_info(struct wbsrv_samba3_call *s3call)
+{
+       s3call->response.result                 = WINBINDD_OK;
+       s3call->response.data.info.winbind_separator = *lp_winbind_separator();
+       WBSRV_SAMBA3_SET_STRING(s3call->response.data.info.samba_version, SAMBA_VERSION_STRING);
+       return NT_STATUS_OK;
+}
+
+NTSTATUS wbsrv_samba3_domain_name(struct wbsrv_samba3_call *s3call)
+{
+       s3call->response.result                 = WINBINDD_OK;
+       WBSRV_SAMBA3_SET_STRING(s3call->response.data.domain_name, lp_workgroup());
+       return NT_STATUS_OK;
+}
+
+NTSTATUS wbsrv_samba3_netbios_name(struct wbsrv_samba3_call *s3call)
+{
+       s3call->response.result                 = WINBINDD_OK;
+       WBSRV_SAMBA3_SET_STRING(s3call->response.data.netbios_name, lp_netbios_name());
+       return NT_STATUS_OK;
+}
+
 NTSTATUS wbsrv_samba3_priv_pipe_dir(struct wbsrv_samba3_call *s3call)
 {
        s3call->response.result                 = WINBINDD_OK;
@@ -70,10 +93,8 @@ static void wbsrv_samba3_check_machacc_reply(struct composite_context *action)
        status = wb_finddcs_recv(action, s3call);
 
        s3call->response.data.auth.nt_status = NT_STATUS_V(status);
-       strncpy(s3call->response.data.auth.nt_status_string, nt_errstr(status),
-               sizeof(s3call->response.data.auth.nt_status_string)-1);
-       strncpy(s3call->response.data.auth.error_string, nt_errstr(status),
-               sizeof(s3call->response.data.auth.error_string)-1);
+       WBSRV_SAMBA3_SET_STRING(s3call->response.data.auth.nt_status_string, nt_errstr(status));
+       WBSRV_SAMBA3_SET_STRING(s3call->response.data.auth.error_string, nt_errstr(status));
        s3call->response.data.auth.pam_error = nt_status_to_pam(status);
 
        if (NT_STATUS_IS_OK(status)) {
index 4519f8954066bcb0362c956361ecc1538a97de15..af63b4c876ff50aff5806cf7b7fbc7f613aa3635 100644 (file)
@@ -72,14 +72,23 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_call *call)
        case WINBINDD_INTERFACE_VERSION:
                return wbsrv_samba3_interface_version(s3call);
 
-       case WINBINDD_PRIV_PIPE_DIR:
-               return wbsrv_samba3_priv_pipe_dir(s3call);
+       case WINBINDD_CHECK_MACHACC:
+               return wbsrv_samba3_check_machacc(s3call);
 
        case WINBINDD_PING:
                return wbsrv_samba3_ping(s3call);
 
-       case WINBINDD_CHECK_MACHACC:
-               return wbsrv_samba3_check_machacc(s3call);
+       case WINBINDD_INFO:
+               return wbsrv_samba3_domain_name(s3call);
+
+       case WINBINDD_DOMAIN_NAME:
+               return wbsrv_samba3_domain_name(s3call);
+
+       case WINBINDD_NETBIOS_NAME:
+               return wbsrv_samba3_netbios_name(s3call);
+
+       case WINBINDD_PRIV_PIPE_DIR:
+               return wbsrv_samba3_priv_pipe_dir(s3call);
        }
 
        s3call->response.result = WINBINDD_ERROR;
index 473a91b7523eca1338e9ef8552a968e8dcaacaa4..9a13210187b27b7a76d9fcf92fa8014c89bbf5d2 100644 (file)
@@ -33,3 +33,7 @@ struct wbsrv_samba3_call {
        /* the response structure of the samba3 protocol*/
        struct winbindd_response response;
 };
+
+#define WBSRV_SAMBA3_SET_STRING(dest, src) do { \
+       strncpy(dest, src, sizeof(dest)-1);\
+} while(0)