diff options
author | Björn Baumbach <bb@sernet.de> | 2018-08-30 16:33:25 +0200 |
---|---|---|
committer | Björn Baumbach <bb@sernet.de> | 2018-10-11 10:28:17 +0200 |
commit | 96b5bf1370fc7975e766dccb1ad70aa57f1d9c6a (patch) | |
tree | c5e3bf99b646d479f96295a7744cf4646eac49c0 /auth | |
parent | 31daab88e6a415e72ead69844e3eccf5dc02e53c (diff) | |
download | samba-96b5bf1370fc7975e766dccb1ad70aa57f1d9c6a.tar.gz |
auth: move copy_session_info() from source3 into the global auth context
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'auth')
-rw-r--r-- | auth/auth_util.c | 68 | ||||
-rw-r--r-- | auth/auth_util.h | 23 | ||||
-rw-r--r-- | auth/wscript_build | 16 |
3 files changed, 105 insertions, 2 deletions
diff --git a/auth/auth_util.c b/auth/auth_util.c new file mode 100644 index 00000000000..f3586f1fc1e --- /dev/null +++ b/auth/auth_util.c @@ -0,0 +1,68 @@ +/* + Unix SMB/CIFS implementation. + Authentication utility functions + + Copyright (C) Andrew Bartlett <abartlet@samba.org> 2017 + + 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 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + 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, see <http://www.gnu.org/licenses/>. +*/ + +#include "includes.h" +#include "librpc/ndr/libndr.h" +#include "librpc/gen_ndr/ndr_auth.h" +#include "auth_util.h" + +struct auth_session_info *copy_session_info(TALLOC_CTX *mem_ctx, + const struct auth_session_info *src) +{ + struct auth_session_info *dst; + DATA_BLOB blob; + enum ndr_err_code ndr_err; + + ndr_err = ndr_push_struct_blob( + &blob, + talloc_tos(), + src, + (ndr_push_flags_fn_t)ndr_push_auth_session_info); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + DBG_ERR("copy_session_info(): ndr_push_auth_session_info " + "failed: %s\n", + ndr_errstr(ndr_err)); + return NULL; + } + + dst = talloc(mem_ctx, struct auth_session_info); + if (dst == NULL) { + DBG_ERR("talloc failed\n"); + TALLOC_FREE(blob.data); + return NULL; + } + + ndr_err = ndr_pull_struct_blob( + &blob, + dst, + dst, + (ndr_pull_flags_fn_t)ndr_pull_auth_session_info); + TALLOC_FREE(blob.data); + + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + DBG_ERR("copy_session_info(): ndr_pull_auth_session_info " + "failed: %s\n", + ndr_errstr(ndr_err)); + TALLOC_FREE(dst); + return NULL; + } + + return dst; +} diff --git a/auth/auth_util.h b/auth/auth_util.h new file mode 100644 index 00000000000..1037cb8361f --- /dev/null +++ b/auth/auth_util.h @@ -0,0 +1,23 @@ +/* + Unix SMB/CIFS implementation. + Authentication utility functions + + Copyright (C) Andrew Bartlett <abartlet@samba.org> 2017 + + 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 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + 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, see <http://www.gnu.org/licenses/>. +*/ + +struct auth_session_info *copy_session_info( + TALLOC_CTX *mem_ctx, + const struct auth_session_info *src); diff --git a/auth/wscript_build b/auth/wscript_build index e2e3d213f48..a8b0e6cf3eb 100644 --- a/auth/wscript_build +++ b/auth/wscript_build @@ -1,8 +1,20 @@ #!/usr/bin/env python bld.SAMBA_LIBRARY('common_auth', - source='auth_sam_reply.c wbc_auth_util.c auth_log.c', - deps='talloc samba-security samba-util util_str_escape LIBTSOCKET audit_logging jansson MESSAGING_SEND server_id_db ', + source='''auth_sam_reply.c + wbc_auth_util.c + auth_log.c + auth_util.c''', + deps='''talloc + samba-security + samba-util + util_str_escape + LIBTSOCKET + audit_logging + jansson + MESSAGING_SEND + server_id_db + ndr-samba''', private_library=True) bld.RECURSE('gensec') |