1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-14 09:49:28 +03:00

libgpo: Remove unused code

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue May 26 11:22:07 UTC 2020 on sn-devel-184
This commit is contained in:
Stefan Metzmacher
2019-11-11 15:56:32 +01:00
committed by Andreas Schneider
parent b2e418369b
commit c40e354fe1
3 changed files with 0 additions and 239 deletions

View File

@ -166,10 +166,6 @@ NTSTATUS gpo_explode_filesyspath(TALLOC_CTX *mem_ctx,
char **service,
char **nt_path,
char **unix_path);
NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx,
ADS_STRUCT *ads,
const char *cache_dir,
const struct GROUP_POLICY_OBJECT *gpo);
NTSTATUS gpo_get_sysvol_gpt_version(TALLOC_CTX *mem_ctx,
const char *unix_path,
uint32_t *sysvol_version,
@ -232,16 +228,6 @@ NTSTATUS gpo_process_gpo_list(TALLOC_CTX *mem_ctx,
const struct GROUP_POLICY_OBJECT *changed_gpo_list,
const char *extensions_guid_filter,
uint32_t flags);
NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
TALLOC_CTX *mem_ctx,
const char *cache_dir,
uint32_t flags,
const struct GROUP_POLICY_OBJECT *gpo);
NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
TALLOC_CTX *mem_ctx,
const char *cache_dir,
uint32_t flags,
const struct GROUP_POLICY_OBJECT *gpo_list);
NTSTATUS gpo_get_unix_path(TALLOC_CTX *mem_ctx,
const char *cache_dir,
const struct GROUP_POLICY_OBJECT *gpo,

View File

@ -82,110 +82,6 @@ NTSTATUS gpo_explode_filesyspath(TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
/****************************************************************
prepare the local disc storage for "unix_path"
****************************************************************/
static NTSTATUS gpo_prepare_local_store(TALLOC_CTX *mem_ctx,
const char *cache_dir,
const char *unix_path)
{
char *current_dir;
char *tok;
current_dir = talloc_strdup(mem_ctx, cache_dir);
NT_STATUS_HAVE_NO_MEMORY(current_dir);
if ((mkdir(cache_dir, 0644)) < 0 && errno != EEXIST) {
return NT_STATUS_ACCESS_DENIED;
}
while (next_token_talloc(mem_ctx, &unix_path, &tok, "/")) {
if (strequal(tok, GPO_CACHE_DIR)) {
break;
}
}
while (next_token_talloc(mem_ctx, &unix_path, &tok, "/")) {
current_dir = talloc_asprintf_append_buffer(current_dir, "/%s", tok);
NT_STATUS_HAVE_NO_MEMORY(current_dir);
if ((mkdir(current_dir, 0644)) < 0 && errno != EEXIST) {
return NT_STATUS_ACCESS_DENIED;
}
}
return NT_STATUS_OK;
}
static NTSTATUS gpo_connect_server(ADS_STRUCT *ads,
const char *server, const char *service, void *ret_cli)
{
NTSTATUS result;
struct cli_state *cli;
result = cli_full_connection(&cli,
lp_netbios_name(),
server,
NULL, 0,
service, "A:",
ads->auth.user_name, NULL,
ads->auth.password,
CLI_FULL_CONNECTION_USE_KERBEROS |
CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS,
SMB_SIGNING_REQUIRED);
if (!NT_STATUS_IS_OK(result)) {
DEBUG(10,("check_refresh_gpo: "
"failed to connect: %s\n",
nt_errstr(result)));
return result;
}
*(struct cli_state **) ret_cli = cli;
return NT_STATUS_OK;
}
/****************************************************************
download a full GPO via CIFS
****************************************************************/
NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx,
ADS_STRUCT *ads,
const char *cache_dir,
const struct GROUP_POLICY_OBJECT *gpo)
{
NTSTATUS result;
char *server, *service, *nt_path, *unix_path;
char *nt_ini_path, *unix_ini_path;
struct cli_state *cli = NULL;
result = gpo_explode_filesyspath(mem_ctx, cache_dir, gpo->file_sys_path,
&server, &service, &nt_path,
&unix_path);
NT_STATUS_NOT_OK_RETURN(result);
/* for now reuse the existing ds connection */
result = gpo_connect_server(ads, server, service, &cli);
NT_STATUS_NOT_OK_RETURN(result);
result = gpo_prepare_local_store(mem_ctx, cache_dir, unix_path);
NT_STATUS_NOT_OK_RETURN(result);
unix_ini_path = talloc_asprintf(mem_ctx, "%s/%s", unix_path, GPT_INI);
nt_ini_path = talloc_asprintf(mem_ctx, "%s\\%s", nt_path, GPT_INI);
NT_STATUS_HAVE_NO_MEMORY(unix_ini_path);
NT_STATUS_HAVE_NO_MEMORY(nt_ini_path);
result = gpo_copy_file(mem_ctx, cli, nt_ini_path, unix_ini_path);
NT_STATUS_NOT_OK_RETURN(result);
result = gpo_sync_directories(mem_ctx, cli, nt_path, unix_path);
NT_STATUS_NOT_OK_RETURN(result);
return NT_STATUS_OK;
}
/****************************************************************
get the locally stored gpt.ini version number
****************************************************************/

View File

@ -467,127 +467,6 @@ NTSTATUS gpo_process_gpo_list(TALLOC_CTX *mem_ctx,
return status;
}
/****************************************************************
check whether the version number in a GROUP_POLICY_OBJECT match those of the
locally stored version. If not, fetch the required policy via CIFS
****************************************************************/
NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
TALLOC_CTX *mem_ctx,
const char *cache_dir,
uint32_t flags,
const struct GROUP_POLICY_OBJECT *gpo)
{
NTSTATUS result;
char *server = NULL;
char *share = NULL;
char *nt_path = NULL;
char *unix_path = NULL;
uint32_t sysvol_gpt_version = 0;
char *display_name = NULL;
result = gpo_explode_filesyspath(mem_ctx, cache_dir, gpo->file_sys_path,
&server, &share, &nt_path, &unix_path);
if (!NT_STATUS_IS_OK(result)) {
goto out;
}
result = gpo_get_sysvol_gpt_version(mem_ctx,
unix_path,
&sysvol_gpt_version,
&display_name);
if (!NT_STATUS_IS_OK(result) &&
!NT_STATUS_EQUAL(result, NT_STATUS_NO_SUCH_FILE)) {
DEBUG(10,("check_refresh_gpo: "
"failed to get local gpt version: %s\n",
nt_errstr(result)));
goto out;
}
DEBUG(10,("check_refresh_gpo: versions gpo %d sysvol %d\n",
gpo->version, sysvol_gpt_version));
/* FIXME: handle GPO_INFO_FLAG_FORCED_REFRESH from flags */
while (gpo->version > sysvol_gpt_version) {
DEBUG(1,("check_refresh_gpo: need to refresh GPO\n"));
result = gpo_fetch_files(mem_ctx, ads, cache_dir, gpo);
if (!NT_STATUS_IS_OK(result)) {
goto out;
}
result = gpo_get_sysvol_gpt_version(mem_ctx,
unix_path,
&sysvol_gpt_version,
&display_name);
if (!NT_STATUS_IS_OK(result)) {
DEBUG(10,("check_refresh_gpo: "
"failed to get local gpt version: %s\n",
nt_errstr(result)));
goto out;
}
if (gpo->version == sysvol_gpt_version) {
break;
}
}
DEBUG(10,("Name:\t\t\t%s (%s)\n", gpo->display_name, gpo->name));
DEBUGADD(10,("sysvol GPT version:\t%d (user: %d, machine: %d)\n",
sysvol_gpt_version,
GPO_VERSION_USER(sysvol_gpt_version),
GPO_VERSION_MACHINE(sysvol_gpt_version)));
DEBUGADD(10,("LDAP GPO version:\t%d (user: %d, machine: %d)\n",
gpo->version,
GPO_VERSION_USER(gpo->version),
GPO_VERSION_MACHINE(gpo->version)));
DEBUGADD(10,("LDAP GPO link:\t\t%s\n", gpo->link));
result = NT_STATUS_OK;
out:
return result;
}
/****************************************************************
check whether the version numbers in the gpo_list match the locally stored, if
not, go and get each required GPO via CIFS
****************************************************************/
NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
TALLOC_CTX *mem_ctx,
const char *cache_dir,
uint32_t flags,
const struct GROUP_POLICY_OBJECT *gpo_list)
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
const struct GROUP_POLICY_OBJECT *gpo;
if (!gpo_list) {
return NT_STATUS_INVALID_PARAMETER;
}
for (gpo = gpo_list; gpo; gpo = gpo->next) {
result = check_refresh_gpo(ads, mem_ctx, cache_dir, flags, gpo);
if (!NT_STATUS_IS_OK(result)) {
goto out;
}
}
result = NT_STATUS_OK;
out:
/* FIXME close cli connection */
return result;
}
/****************************************************************
****************************************************************/