Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

Location:
vendor/current/source3/libgpo
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/libgpo/gpext/registry.c

    r740 r988  
    2424#include "registry.h"
    2525#include "../librpc/gen_ndr/ndr_preg.h"
     26#include "libgpo/gpext/gpext.h"
    2627
    2728#define GP_EXT_NAME "registry"
     
    112113        ZERO_STRUCTP(*reg_entry);
    113114
    114         data = TALLOC_ZERO_P(mem_ctx, struct registry_value);
     115        data = talloc_zero(mem_ctx, struct registry_value);
    115116        if (!data)
    116117                return false;
     
    119120        data->data = data_blob_talloc(data, r->data, r->size);
    120121
    121         entry = TALLOC_ZERO_P(mem_ctx, struct gp_registry_entry);
     122        entry = talloc_zero(mem_ctx, struct gp_registry_entry);
    122123        if (!entry)
    123124                return false;
     
    173174                status = ndr_map_error2ntstatus(ndr_err);
    174175                goto out;
     176        }
     177
     178        if (flags & GPO_INFO_FLAG_VERBOSE) {
     179                NDR_PRINT_DEBUG(preg_file, &r);
    175180        }
    176181
     
    270275****************************************************************/
    271276
    272 static NTSTATUS registry_process_group_policy(ADS_STRUCT *ads,
    273                                               TALLOC_CTX *mem_ctx,
     277static NTSTATUS registry_process_group_policy(TALLOC_CTX *mem_ctx,
    274278                                              uint32_t flags,
    275279                                              struct registry_key *root_key,
    276280                                              const struct security_token *token,
    277                                               struct GROUP_POLICY_OBJECT *gpo,
    278                                               const char *extension_guid,
    279                                               const char *snapin_guid)
     281                                              const struct GROUP_POLICY_OBJECT *deleted_gpo_list,
     282                                              const struct GROUP_POLICY_OBJECT *changed_gpo_list)
    280283{
    281284        NTSTATUS status;
     
    284287        size_t num_entries = 0;
    285288        char *unix_path = NULL;
    286 
    287         debug_gpext_header(0, "registry_process_group_policy", flags, gpo,
    288                            extension_guid, snapin_guid);
    289 
    290         status = gpo_get_unix_path(mem_ctx, cache_path(GPO_CACHE_DIR), gpo, &unix_path);
    291         NT_STATUS_NOT_OK_RETURN(status);
    292 
    293         status = reg_parse_registry(mem_ctx,
    294                                     flags,
    295                                     unix_path,
    296                                     &entries,
    297                                     &num_entries);
    298         if (!NT_STATUS_IS_OK(status)) {
    299                 DEBUG(0,("failed to parse registry: %s\n",
    300                         nt_errstr(status)));
    301                 return status;
    302         }
    303 
    304         dump_reg_entries(flags, "READ", entries, num_entries);
    305 
    306         werr = reg_apply_registry(mem_ctx, token, root_key, flags,
    307                                   entries, num_entries);
    308         if (!W_ERROR_IS_OK(werr)) {
    309                 DEBUG(0,("failed to apply registry: %s\n",
    310                         win_errstr(werr)));
    311                 return werror_to_ntstatus(werr);
    312         }
    313 
    314         return NT_STATUS_OK;
     289        const struct GROUP_POLICY_OBJECT *gpo;
     290        char *gpo_cache_path = cache_path(GPO_CACHE_DIR);
     291        if (gpo_cache_path == NULL) {
     292                return NT_STATUS_NO_MEMORY;
     293        }
     294
     295        /* implementation of the policy callback function, see
     296         * http://msdn.microsoft.com/en-us/library/aa373494%28v=vs.85%29.aspx
     297         * for details - gd */
     298
     299        /* for now do not process the list of deleted group policies
     300
     301        for (gpo = deleted_gpo_list; gpo; gpo = gpo->next) {
     302        }
     303
     304        */
     305
     306        for (gpo = changed_gpo_list; gpo; gpo = gpo->next) {
     307
     308                gpext_debug_header(0, "registry_process_group_policy", flags,
     309                                   gpo, GP_EXT_GUID_REGISTRY, NULL);
     310
     311                status = gpo_get_unix_path(mem_ctx, gpo_cache_path,
     312                                           gpo, &unix_path);
     313                if (!NT_STATUS_IS_OK(status)) {
     314                        goto err_cache_path_free;
     315                }
     316
     317                status = reg_parse_registry(mem_ctx,
     318                                            flags,
     319                                            unix_path,
     320                                            &entries,
     321                                            &num_entries);
     322                if (!NT_STATUS_IS_OK(status)) {
     323                        DEBUG(0,("failed to parse registry: %s\n",
     324                                nt_errstr(status)));
     325                        goto err_cache_path_free;
     326                }
     327
     328                dump_reg_entries(flags, "READ", entries, num_entries);
     329
     330                werr = reg_apply_registry(mem_ctx, token, root_key, flags,
     331                                          entries, num_entries);
     332                if (!W_ERROR_IS_OK(werr)) {
     333                        DEBUG(0,("failed to apply registry: %s\n",
     334                                win_errstr(werr)));
     335                        status = werror_to_ntstatus(werr);
     336                        goto err_cache_path_free;
     337                }
     338        }
     339        status = NT_STATUS_OK;
     340
     341err_cache_path_free:
     342        talloc_free(gpo_cache_path);
     343        return status;
    315344}
    316345
     
    328357        };
    329358
    330         info = TALLOC_ZERO_P(mem_ctx, struct gp_extension_reg_info);
     359        info = talloc_zero(mem_ctx, struct gp_extension_reg_info);
    331360        NT_STATUS_HAVE_NO_MEMORY(info);
    332361
    333         status = gp_ext_info_add_entry(mem_ctx, GP_EXT_NAME,
    334                                        GP_EXT_GUID_REGISTRY,
    335                                        table, info);
     362        status = gpext_info_add_entry(mem_ctx, GP_EXT_NAME,
     363                                      GP_EXT_GUID_REGISTRY,
     364                                      table, info);
    336365        NT_STATUS_NOT_OK_RETURN(status);
    337366
     
    356385        NTSTATUS status;
    357386
    358         status = unregister_gp_extension(GP_EXT_NAME);
     387        status = gpext_unregister_gp_extension(GP_EXT_NAME);
    359388        if (NT_STATUS_IS_OK(status)) {
    360389                return status;
     
    386415        NT_STATUS_HAVE_NO_MEMORY(ctx);
    387416
    388         status = register_gp_extension(ctx, SMB_GPEXT_INTERFACE_VERSION,
    389                                        GP_EXT_NAME, GP_EXT_GUID_REGISTRY,
    390                                        &registry_methods);
     417        status = gpext_register_gp_extension(ctx, SMB_GPEXT_INTERFACE_VERSION,
     418                                             GP_EXT_NAME, GP_EXT_GUID_REGISTRY,
     419                                             &registry_methods);
    391420        if (!NT_STATUS_IS_OK(status)) {
    392421                TALLOC_FREE(ctx);
  • vendor/current/source3/libgpo/gpext/scripts.c

    r740 r988  
    2525#include "registry/reg_api.h"
    2626#include "../libcli/registry/util_reg.h"
     27#include "libgpo/gpext/gpext.h"
    2728
    2829#define GP_EXT_NAME "scripts"
     
    6364        };
    6465
    65         info = TALLOC_ZERO_P(mem_ctx, struct gp_extension_reg_info);
     66        info = talloc_zero(mem_ctx, struct gp_extension_reg_info);
    6667        NT_STATUS_HAVE_NO_MEMORY(info);
    6768
    68         status = gp_ext_info_add_entry(mem_ctx, GP_EXT_NAME,
    69                                        GP_EXT_GUID_SCRIPTS,
    70                                        table, info);
     69        status = gpext_info_add_entry(mem_ctx, GP_EXT_NAME,
     70                                      GP_EXT_GUID_SCRIPTS,
     71                                      table, info);
    7172        NT_STATUS_NOT_OK_RETURN(status);
    7273
     
    9091        struct registry_value *data = NULL;
    9192
    92         entry = TALLOC_ZERO_P(mem_ctx, struct gp_registry_entry);
     93        entry = talloc_zero(mem_ctx, struct gp_registry_entry);
    9394        NT_STATUS_HAVE_NO_MEMORY(entry);
    9495
    95         data = TALLOC_ZERO_P(mem_ctx, struct registry_value);
     96        data = talloc_zero(mem_ctx, struct registry_value);
    9697        NT_STATUS_HAVE_NO_MEMORY(data);
    9798
     
    103104                        break;
    104105                case REG_SZ:
    105                         if (!push_reg_sz(mem_ctx, &data->data, (char *)data_p)) {
     106                        if (!push_reg_sz(mem_ctx, &data->data, (const char *)data_p)) {
    106107                                return NT_STATUS_NO_MEMORY;
    107108                        }
     
    228229static WERROR scripts_store_reg_gpovals(TALLOC_CTX *mem_ctx,
    229230                                        struct registry_key *key,
    230                                         struct GROUP_POLICY_OBJECT *gpo)
     231                                        const struct GROUP_POLICY_OBJECT *gpo)
    231232{
    232233        WERROR werr;
     
    267268                            uint32_t flags,
    268269                            const char *section,
    269                             struct GROUP_POLICY_OBJECT *gpo,
     270                            const struct GROUP_POLICY_OBJECT *gpo,
    270271                            struct gp_registry_entry *entries,
    271272                            size_t num_entries)
     
    336337****************************************************************/
    337338
    338 static NTSTATUS scripts_process_group_policy(ADS_STRUCT *ads,
    339                                              TALLOC_CTX *mem_ctx,
     339static NTSTATUS scripts_process_group_policy(TALLOC_CTX *mem_ctx,
    340340                                             uint32_t flags,
    341341                                             struct registry_key *root_key,
    342342                                             const struct security_token *token,
    343                                              struct GROUP_POLICY_OBJECT *gpo,
    344                                              const char *extension_guid,
    345                                              const char *snapin_guid)
     343                                             const struct GROUP_POLICY_OBJECT *deleted_gpo_list,
     344                                             const struct GROUP_POLICY_OBJECT *changed_gpo_list)
    346345{
    347346        NTSTATUS status;
     
    358357                GP_SCRIPTS_INI_LOGOFF
    359358        };
    360 
    361         debug_gpext_header(0, "scripts_process_group_policy", flags, gpo,
    362                            extension_guid, snapin_guid);
    363 
    364         status = gpo_get_unix_path(mem_ctx, cache_path(GPO_CACHE_DIR), gpo, &unix_path);
    365         NT_STATUS_NOT_OK_RETURN(status);
    366 
    367         status = gp_inifile_init_context(mem_ctx, flags, unix_path,
    368                                          GP_SCRIPTS_INI, &ini_ctx);
    369         NT_STATUS_NOT_OK_RETURN(status);
    370 
    371         for (i = 0; i < ARRAY_SIZE(list); i++) {
    372 
    373                 TALLOC_FREE(entries);
    374                 num_entries = 0;
    375 
    376                 status = scripts_parse_ini_section(ini_ctx, flags, list[i],
    377                                                    &entries, &num_entries);
    378                 if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
    379                         continue;
    380                 }
    381 
     359        const struct GROUP_POLICY_OBJECT *gpo;
     360        char *gpo_cache_path = cache_path(GPO_CACHE_DIR);
     361        if (gpo_cache_path == NULL) {
     362                return NT_STATUS_NO_MEMORY;
     363        }
     364
     365        /* implementation of the policy callback function, see
     366         * http://msdn.microsoft.com/en-us/library/aa373494%28v=vs.85%29.aspx
     367         * for details - gd */
     368
     369        /* for now do not process the list of deleted group policies
     370
     371        for (gpo = deleted_gpo_list; gpo; gpo = gpo->next) {
     372        }
     373
     374        */
     375
     376        for (gpo = changed_gpo_list; gpo; gpo = gpo->next) {
     377
     378                gpext_debug_header(0, "scripts_process_group_policy", flags,
     379                                   gpo, GP_EXT_GUID_SCRIPTS, NULL);
     380
     381                status = gpo_get_unix_path(mem_ctx, gpo_cache_path,
     382                                           gpo, &unix_path);
    382383                if (!NT_STATUS_IS_OK(status)) {
    383                         return status;
    384                 }
    385 
    386                 dump_reg_entries(flags, "READ", entries, num_entries);
    387 
    388                 werr = scripts_apply(ini_ctx->mem_ctx, token, root_key,
    389                                      flags, list[i], gpo, entries, num_entries);
    390                 if (!W_ERROR_IS_OK(werr)) {
    391                         continue; /* FIXME: finally fix storing emtpy strings and REG_QWORD! */
    392                         TALLOC_FREE(ini_ctx);
    393                         return werror_to_ntstatus(werr);
    394                 }
    395         }
    396 
    397         TALLOC_FREE(ini_ctx);
     384                        goto err_cache_path_free;
     385                }
     386
     387                status = gp_inifile_init_context(mem_ctx, flags, unix_path,
     388                                                 GP_SCRIPTS_INI, &ini_ctx);
     389                if (!NT_STATUS_IS_OK(status)) {
     390                        goto err_cache_path_free;
     391                }
     392
     393                for (i = 0; i < ARRAY_SIZE(list); i++) {
     394
     395                        TALLOC_FREE(entries);
     396                        num_entries = 0;
     397
     398                        status = scripts_parse_ini_section(ini_ctx, flags, list[i],
     399                                                           &entries, &num_entries);
     400                        if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
     401                                continue;
     402                        }
     403
     404                        if (!NT_STATUS_IS_OK(status)) {
     405                                TALLOC_FREE(ini_ctx);
     406                                goto err_cache_path_free;
     407                        }
     408
     409                        dump_reg_entries(flags, "READ", entries, num_entries);
     410
     411                        werr = scripts_apply(ini_ctx->mem_ctx, token, root_key,
     412                                             flags, list[i], gpo, entries, num_entries);
     413                        if (!W_ERROR_IS_OK(werr)) {
     414                                continue; /* FIXME: finally fix storing emtpy strings and REG_QWORD! */
     415                        }
     416                }
     417
     418                TALLOC_FREE(ini_ctx);
     419        }
     420        status = NT_STATUS_OK;
     421
     422err_cache_path_free:
     423        talloc_free(gpo_cache_path);
     424        return status;
     425}
     426
     427/****************************************************************
     428****************************************************************/
     429
     430static NTSTATUS scripts_initialize(TALLOC_CTX *mem_ctx)
     431{
    398432        return NT_STATUS_OK;
    399433}
     
    402436****************************************************************/
    403437
    404 static NTSTATUS scripts_initialize(TALLOC_CTX *mem_ctx)
    405 {
    406         return NT_STATUS_OK;
    407 }
    408 
    409 /****************************************************************
    410 ****************************************************************/
    411 
    412438static NTSTATUS scripts_shutdown(void)
    413439{
    414440        NTSTATUS status;
    415441
    416         status = unregister_gp_extension(GP_EXT_NAME);
     442        status = gpext_unregister_gp_extension(GP_EXT_NAME);
    417443        if (NT_STATUS_IS_OK(status)) {
    418444                return status;
     
    444470        NT_STATUS_HAVE_NO_MEMORY(ctx);
    445471
    446         status = register_gp_extension(ctx, SMB_GPEXT_INTERFACE_VERSION,
    447                                        GP_EXT_NAME, GP_EXT_GUID_SCRIPTS,
    448                                        &scripts_methods);
     472        status = gpext_register_gp_extension(ctx, SMB_GPEXT_INTERFACE_VERSION,
     473                                             GP_EXT_NAME, GP_EXT_GUID_SCRIPTS,
     474                                             &scripts_methods);
    449475        if (!NT_STATUS_IS_OK(status)) {
    450476                TALLOC_FREE(ctx);
  • vendor/current/source3/libgpo/gpext/security.c

    r740 r988  
    2222#include "../libgpo/gpo.h"
    2323#include "libgpo/gpo_proto.h"
     24#include "libgpo/gpext/gpext.h"
    2425
    2526#define GP_EXT_NAME "security"
     
    5657#define GPTTMPL_PARAMETER_REVISION "Revision"
    5758#define GPTTMPL_PARAMETER_SIGNATURE "signature"
    58 #define GPTTMPL_VALUE_CHICAGO "$CHICAGO$" /* whatever this is good for... */
     59#define GPTTMPL_VALUE_CHICAGO "\"$CHICAGO$\"" /* whatever this is good for... */
    5960#define GPTTMPL_PARAMETER_UNICODE "Unicode"
    6061
     
    6566        NTSTATUS result;
    6667        int version;
    67         int is_unicode;
     68        bool is_unicode = false;
    6869
    6970        if (!ini_ctx) {
     
    9091        }
    9192
    92         result = gp_inifile_getint(ini_ctx, GPTTMPL_SECTION_UNICODE
     93        result = gp_inifile_getbool(ini_ctx, GPTTMPL_SECTION_UNICODE
    9394                        ":"GPTTMPL_PARAMETER_UNICODE, &is_unicode);
    9495        if (!NT_STATUS_IS_OK(result) || !is_unicode) {
     
    141142****************************************************************/
    142143
    143 static NTSTATUS security_process_group_policy(ADS_STRUCT *ads,
    144                                               TALLOC_CTX *mem_ctx,
     144static NTSTATUS security_process_group_policy(TALLOC_CTX *mem_ctx,
    145145                                              uint32_t flags,
    146146                                              struct registry_key *root_key,
    147147                                              const struct security_token *token,
    148                                               struct GROUP_POLICY_OBJECT *gpo,
    149                                               const char *extension_guid,
    150                                               const char *snapin_guid)
     148                                              const struct GROUP_POLICY_OBJECT *deleted_gpo_list,
     149                                              const struct GROUP_POLICY_OBJECT *changed_gpo_list)
    151150{
    152151        NTSTATUS status;
    153152        char *unix_path = NULL;
    154153        struct gp_inifile_context *ini_ctx = NULL;
    155 
    156         debug_gpext_header(0, "security_process_group_policy", flags, gpo,
    157                            extension_guid, snapin_guid);
    158 
    159         /* this handler processes the gpttmpl files and merge output to the
    160          * registry */
    161 
    162         status = gpo_get_unix_path(mem_ctx, cache_path(GPO_CACHE_DIR), gpo, &unix_path);
    163         if (!NT_STATUS_IS_OK(status)) {
    164                 goto out;
    165         }
    166 
    167         status = gpttmpl_init_context(mem_ctx, flags, unix_path, &ini_ctx);
    168         if (!NT_STATUS_IS_OK(status)) {
    169                 goto out;
    170         }
    171 
    172         status = gpttmpl_process(ini_ctx, root_key, flags);
    173         if (!NT_STATUS_IS_OK(status)) {
    174                 goto out;
     154        const struct GROUP_POLICY_OBJECT *gpo;
     155        char *gpo_cache_path = cache_path(GPO_CACHE_DIR);
     156        if (gpo_cache_path == NULL) {
     157                return NT_STATUS_NO_MEMORY;
     158        }
     159
     160        /* implementation of the policy callback function, see
     161         * http://msdn.microsoft.com/en-us/library/aa373494%28v=vs.85%29.aspx
     162         * for details - gd */
     163
     164        /* for now do not process the list of deleted group policies
     165
     166        for (gpo = deleted_gpo_list; gpo; gpo = gpo->next) {
     167        }
     168
     169        */
     170
     171        for (gpo = changed_gpo_list; gpo; gpo = gpo->next) {
     172
     173                gpext_debug_header(0, "security_process_group_policy", flags,
     174                                   gpo, GP_EXT_GUID_SECURITY, NULL);
     175
     176                /* this handler processes the gpttmpl files and merge output to the
     177                 * registry */
     178
     179                status = gpo_get_unix_path(mem_ctx, gpo_cache_path,
     180                                           gpo, &unix_path);
     181                if (!NT_STATUS_IS_OK(status)) {
     182                        goto out;
     183                }
     184
     185                status = gpttmpl_init_context(mem_ctx, flags, unix_path,
     186                                              &ini_ctx);
     187                if (!NT_STATUS_IS_OK(status)) {
     188                        goto out;
     189                }
     190
     191                status = gpttmpl_process(ini_ctx, root_key, flags);
     192                if (!NT_STATUS_IS_OK(status)) {
     193                        goto out;
     194                }
     195
     196                TALLOC_FREE(ini_ctx);
    175197        }
    176198
     
    181203        }
    182204        TALLOC_FREE(ini_ctx);
     205        talloc_free(gpo_cache_path);
    183206
    184207        return status;
     
    203226        };
    204227
    205         info = TALLOC_ZERO_P(mem_ctx, struct gp_extension_reg_info);
     228        info = talloc_zero(mem_ctx, struct gp_extension_reg_info);
    206229        NT_STATUS_HAVE_NO_MEMORY(info);
    207230
    208         status = gp_ext_info_add_entry(mem_ctx, GP_EXT_NAME,
    209                                        GP_EXT_GUID_SECURITY,
    210                                        table, info);
     231        status = gpext_info_add_entry(mem_ctx, GP_EXT_NAME,
     232                                      GP_EXT_GUID_SECURITY,
     233                                      table, info);
    211234        NT_STATUS_NOT_OK_RETURN(status);
    212235
     
    232255        NTSTATUS status;
    233256
    234         status = unregister_gp_extension(GP_EXT_NAME);
     257        status = gpext_unregister_gp_extension(GP_EXT_NAME);
    235258        if (NT_STATUS_IS_OK(status)) {
    236259                return status;
     
    262285        NT_STATUS_HAVE_NO_MEMORY(ctx);
    263286
    264         status = register_gp_extension(ctx, SMB_GPEXT_INTERFACE_VERSION,
    265                                        GP_EXT_NAME, GP_EXT_GUID_SECURITY,
    266                                        &security_methods);
     287        status = gpext_register_gp_extension(ctx, SMB_GPEXT_INTERFACE_VERSION,
     288                                             GP_EXT_NAME, GP_EXT_GUID_SECURITY,
     289                                             &security_methods);
    267290        if (!NT_STATUS_IS_OK(status)) {
    268291                TALLOC_FREE(ctx);
  • vendor/current/source3/libgpo/gpext/wscript_build

    r740 r988  
    11#!/usr/bin/env python
    22
    3 GPEXT_REGISTRY_SRC = 'registry.c'
    4 GPEXT_SCRIPTS_SRC = 'scripts.c'
    5 GPEXT_SECURITY_SRC = 'security.c'
    6 
    7 GPEXT_SRC = '''../../../libgpo/gpext/gpext.c'''
    8 
    93bld.SAMBA3_SUBSYSTEM('gpext',
    10                     source=GPEXT_SRC,
    11                     vars=locals())
     4                    source='../../../libgpo/gpext/gpext.c',
     5                    deps='samba-util samba3core gpo')
    126
    137bld.SAMBA3_MODULE('gpext_registry',
    148                 subsystem='gpext',
    15                  source=GPEXT_REGISTRY_SRC,
     9                 source='registry.c',
    1610                 deps='NDR_PREG',
    1711                 init_function='',
     
    2115bld.SAMBA3_MODULE('gpext_scripts',
    2216                 subsystem='gpext',
    23                  source=GPEXT_SCRIPTS_SRC,
     17                 source='scripts.c',
    2418                 init_function='',
    2519                 internal_module=bld.SAMBA3_IS_STATIC_MODULE('gpext_scripts'),
     
    2822bld.SAMBA3_MODULE('gpext_security',
    2923                 subsystem='gpext',
    30                  source=GPEXT_SECURITY_SRC,
     24                 source='security.c',
    3125                 init_function='',
    3226                 internal_module=bld.SAMBA3_IS_STATIC_MODULE('gpext_security'),
  • vendor/current/source3/libgpo/gpo_filesync.c

    r740 r988  
    5151        off_t nread = 0;
    5252
    53         result = cli_open(cli, nt_path, O_RDONLY, DENY_NONE, &fnum);
     53        result = cli_openx(cli, nt_path, O_RDONLY, DENY_NONE, &fnum);
    5454        if (!NT_STATUS_IS_OK(result)) {
    5555                goto out;
    5656        }
    5757
    58         if ((fd = sys_open(unix_path, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) {
     58        if ((fd = open(unix_path, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) {
    5959                result = map_nt_error_from_unix(errno);
    6060                goto out;
     
    6767
    6868        while (1) {
    69 
    70                 int n = cli_read(cli, fnum, data, nread, read_size);
    71 
    72                 if (n <= 0)
     69                size_t n = 0;
     70
     71                result = cli_read(cli, fnum, data, nread, read_size, &n);
     72                if (!NT_STATUS_IS_OK(result)) {
     73                        goto out;
     74                }
     75
     76                if (n == 0)
    7377                        break;
    7478
     
    228232        ctx.mem_ctx     = mem_ctx;
    229233        ctx.cli         = cli;
    230         ctx.remote_path = CONST_DISCARD(char *, nt_path);
    231         ctx.local_path  = CONST_DISCARD(char *, local_path);
     234        ctx.remote_path = discard_const_p(char, nt_path);
     235        ctx.local_path  = discard_const_p(char, local_path);
    232236        ctx.attribute   = (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY);
    233237
  • vendor/current/source3/libgpo/gpo_proto.h

    r740 r988  
    3232                              const char *nt_path,
    3333                              const char *local_path);
    34 
    35 /* The following definitions come from libgpo/gpo_ini.c  */
    36 
    37 NTSTATUS parse_gpt_ini(TALLOC_CTX *mem_ctx,
    38                        const char *filename,
    39                        uint32_t *version,
    40                        char **display_name);
    4134
    4235/* The following definitions come from libgpo/gpo_reg.c  */
  • vendor/current/source3/libgpo/gpo_reg.c

    r740 r988  
    3737        struct security_token *token = NULL;
    3838
    39         token = TALLOC_ZERO_P(mem_ctx, struct security_token);
     39        token = talloc_zero(mem_ctx, struct security_token);
    4040        if (!token) {
    4141                DEBUG(1,("talloc failed\n"));
     
    7575        }
    7676
    77         tmp_ctx = TALLOC_ZERO_P(mem_ctx, struct gp_registry_context);
     77        tmp_ctx = talloc_zero(mem_ctx, struct gp_registry_context);
    7878        W_ERROR_HAVE_NO_MEMORY(tmp_ctx);
    7979
     
    286286
    287287        werr = gp_store_reg_val_sz(mem_ctx, key, "SOM",
    288                                    gpo->link);
     288                                   gpo->link ? gpo->link : "");
    289289        W_ERROR_NOT_OK_RETURN(werr);
    290290
     
    294294
    295295        werr = gp_store_reg_val_sz(mem_ctx, key, "WQL-Id",
    296                                    NULL);
     296                                   "");
    297297        W_ERROR_NOT_OK_RETURN(werr);
    298298
     
    396396        struct security_token *tmp_token = NULL;
    397397
    398         tmp_token = TALLOC_ZERO_P(mem_ctx, struct security_token);
     398        tmp_token = talloc_zero(mem_ctx, struct security_token);
    399399        W_ERROR_HAVE_NO_MEMORY(tmp_token);
    400400
     
    543543                if (!W_ERROR_IS_OK(werr)) {
    544544                        DEBUG(0,("gp_reg_state_store: "
    545                                 "gpo_store_reg_gpovals failed for %s: %s\n",
     545                                "gp_store_reg_gpovals failed for %s: %s\n",
    546546                                gpo->display_name, win_errstr(werr)));
    547547                        goto done;
     
    603603        }
    604604
    605         gpo = TALLOC_ZERO_P(mem_ctx, struct GROUP_POLICY_OBJECT);
     605        gpo = talloc_zero(mem_ctx, struct GROUP_POLICY_OBJECT);
    606606        W_ERROR_HAVE_NO_MEMORY(gpo);
    607607
     
    902902                                    size_t *num)
    903903{
    904         *entries = TALLOC_REALLOC_ARRAY(mem_ctx, *entries,
     904        *entries = talloc_realloc(mem_ctx, *entries,
    905905                                        struct gp_registry_entry,
    906906                                        (*num)+1);
Note: See TracChangeset for help on using the changeset viewer.