ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth AD GPO Backend Module -- perform SMB and CSE processing in a child process
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth Yassir Elley <yelley@redhat.com>
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth Copyright (C) 2013 Red Hat
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth This program is free software; you can redistribute it and/or modify
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth it under the terms of the GNU General Public License as published by
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth the Free Software Foundation; either version 3 of the License, or
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth (at your option) any later version.
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth This program is distributed in the hope that it will be useful,
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth but WITHOUT ANY WARRANTY; without even the implied warranty of
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth GNU General Public License for more details.
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth You should have received a copy of the GNU General Public License
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth along with this program. If not, see <http://www.gnu.org/licenses/>.
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth /* cached_gpt_version */
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth SAFEALIGN_COPY_UINT32_CHECK(&cached_gpt_version, buf + p, size, &p);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth DEBUG(SSSDBG_TRACE_FUNC, "cached_gpt_version: %d\n", cached_gpt_version);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth /* smb_server */
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth DEBUG(SSSDBG_TRACE_ALL, "smb_server length: %d\n", len);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth if (len == 0) {
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth ibuf->smb_server = talloc_strndup(ibuf, (char *)(buf + p), len);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth DEBUG(SSSDBG_TRACE_ALL, "smb_server: %s\n", ibuf->smb_server);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth /* smb_share */
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth if (len == 0) {
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth ibuf->smb_share = talloc_strndup(ibuf, (char *)(buf + p), len);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth DEBUG(SSSDBG_TRACE_ALL, "smb_share: %s\n", ibuf->smb_share);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth /* smb_path */
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth if (len == 0) {
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth ibuf->smb_path = talloc_strndup(ibuf, (char *)(buf + p), len);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth DEBUG(SSSDBG_TRACE_ALL, "smb_path: %s\n", ibuf->smb_path);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth /* smb_cse_suffix */
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth DEBUG(SSSDBG_TRACE_ALL, "smb_cse_suffix length: %d\n", len);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth if (len == 0) {
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth ibuf->smb_cse_suffix = talloc_strndup(ibuf, (char *)(buf + p), len);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth DEBUG(SSSDBG_TRACE_ALL, "smb_cse_suffix: %s\n", ibuf->smb_cse_suffix);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth /* A buffer with the following structure must be created:
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth * uint32_t sysvol_gpt_version (required)
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth * uint32_t status of the request (required)
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth /* sysvol_gpt_version */
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth SAFEALIGN_SET_UINT32(&r->buf[p], sysvol_gpt_version, &p);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth /* result */
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth if (r == NULL) {
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cthstatic void
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth const char * pShare,
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth /* since we are using kerberos for authentication, we simply return */
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth * This function prepares the gpo_cache by:
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth * - parsing the input_smb_path into its component directories
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth * - creating each component directory (if it doesn't already exist)
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth const char *cache_dir,
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth smb_path_with_suffix = talloc_strdup(mem_ctx, input_smb_path_with_suffix);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth DEBUG(SSSDBG_TRACE_ALL, "smb_path_with_suffix: %s\n", smb_path_with_suffix);
ff2aee480f8fc985fe6a84c8d593c7a13c7a0481cth for (i = 0; i < num_dirs; i++) {
goto done;
goto done;
done:
return ret;
const char *smb_cse_suffix,
int buflen)
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
errno = 0;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
static errno_t
int *_gpt_version)
if (ret != 0) {
goto done;
goto done;
if (ret != 0) {
goto done;
done:
return ret;
static errno_t
int *_gpt_version)
goto done;
goto done;
if (ret != 0) {
goto done;
if (ret != 0) {
goto done;
if (ret != 0) {
if (lret != 0) {
goto done;
for (int i = 0; errors[i]; i++) {
goto done;
if (ret != 0) {
goto done;
done:
return ret;
static errno_t
const char *smb_server,
const char *smb_share,
const char *smb_path,
const char *smb_cse_suffix)
return ENOMEM;
goto done;
errno = 0;
goto done;
goto done;
errno = 0;
if (buflen < 0) {
goto done;
goto done;
done:
return ret;
static errno_t
const char *smb_server,
const char *smb_share,
const char *smb_path,
const char *smb_cse_suffix,
int *_sysvol_gpt_version)
goto done;
goto done;
GPT_INI);
goto done;
goto done;
goto done;
done:
return ret;
&debug_to_stderr, 0,
switch(opt) {
goto fail;
goto fail;
goto fail;
goto fail;
errno = 0;
goto fail;
goto fail;
goto fail;
goto fail;
errno = 0;
goto fail;
goto fail;
return EXIT_SUCCESS;
fail:
return EXIT_FAILURE;