diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-05-28 13:21:26 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-05-28 13:21:26 +1000 |
commit | baa2dffdf34c2f3aa150695c60742d616eeb3b09 (patch) | |
tree | 3ba717535b47cfcd039277285d5d7681ac7ae691 /source4/ntp_signd/ntp_signd.c | |
parent | 51ae2302a68033b1b79a4ebc8d4cbab64adcf843 (diff) | |
download | samba-baa2dffdf34c2f3aa150695c60742d616eeb3b09.tar.gz samba-baa2dffdf34c2f3aa150695c60742d616eeb3b09.tar.bz2 samba-baa2dffdf34c2f3aa150695c60742d616eeb3b09.zip |
Bring up the ntp signing deamon
This starts ntp_signd at startup, and fixes some build issues.
Andrew Bartlett
(This used to be commit cb0dcd5c3dfe2a46755270a4594b7289f555d814)
Diffstat (limited to 'source4/ntp_signd/ntp_signd.c')
-rw-r--r-- | source4/ntp_signd/ntp_signd.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/source4/ntp_signd/ntp_signd.c b/source4/ntp_signd/ntp_signd.c index 41a3df019a..35016d5c61 100644 --- a/source4/ntp_signd/ntp_signd.c +++ b/source4/ntp_signd/ntp_signd.c @@ -27,10 +27,13 @@ #include "smbd/service_stream.h" #include "smbd/process_model.h" #include "lib/stream/packet.h" -#include "librpc/gen_ndr/ntp_signd.h" +#include "librpc/gen_ndr/ndr_ntp_signd.h" #include "param/param.h" #include "dsdb/samdb/samdb.h" #include "auth/auth.h" +#include "libcli/security/security.h" +#include "lib/ldb/include/ldb.h" +#include "lib/ldb/include/ldb_errors.h" /* top level context structure for the ntp_signd server @@ -74,13 +77,14 @@ static NTSTATUS ntp_signd_recv(void *private, DATA_BLOB blob) enum ndr_err_code ndr_err; struct ldb_result *res; const char *attrs[] = { "unicodePwd", NULL }; + int ret; talloc_steal(tmp_ctx, blob.data); input = data_blob_const(blob.data + 4, blob.length - 4); - ndr_err = ndr_pull_struct_blob_all(input, tmp_ctx, - iconv_convenience, + ndr_err = ndr_pull_struct_blob_all(&input, tmp_ctx, + lp_iconv_convenience(ntp_signdconn->ntp_signd->task->lp_ctx), &sign_request, (ndr_pull_flags_fn_t)ndr_pull_sign_request); @@ -101,9 +105,10 @@ static NTSTATUS ntp_signd_recv(void *private, DATA_BLOB blob) } /* Sign packet */ - ret = ldb_search_exp_format(ntp_signdconn->ntp_signd->samdb, tmp_ctx, - &res, samdb_base_dn(ntp_signdconn->ntp_signd->samdb), - LDB_SCOPE_SUBTREE, attrs, "(&(objectSid=%s)(objectClass=computer))"); + ret = ldb_search_exp_fmt(ntp_signdconn->ntp_signd->samdb, tmp_ctx, + &res, samdb_base_dn(ntp_signdconn->ntp_signd->samdb), + LDB_SCOPE_SUBTREE, attrs, "(&(objectSid=%s)(objectClass=computer))", + dom_sid_string(tmp_ctx, sid)); if (ret != LDB_SUCCESS) { return NT_STATUS_UNSUCCESSFUL; } @@ -221,19 +226,6 @@ static void ntp_signd_task_init(struct task_server *task) return; } - status = stream_setup_socket(ntp_signd->task->event_ctx, - ntp_signd->task->lp_ctx, - model_ops, - &ntp_signd_stream_ops, - "unix", address, NULL, - lp_socket_options(ntp_signd->task->lp_ctx), - ntp_signd); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("Failed to bind to %s - %s\n", - address, nt_errstr(status))); - return; - } - task_server_set_title(task, "task[ntp_signd]"); ntp_signd = talloc(task, struct ntp_signd_server); @@ -250,6 +242,19 @@ static void ntp_signd_task_init(struct task_server *task) return; } + status = stream_setup_socket(ntp_signd->task->event_ctx, + ntp_signd->task->lp_ctx, + model_ops, + &ntp_signd_stream_ops, + "unix", address, NULL, + lp_socket_options(ntp_signd->task->lp_ctx), + ntp_signd); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Failed to bind to %s - %s\n", + address, nt_errstr(status))); + return; + } + } |