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/lib/netapi
Files:
4 added
2 deleted
32 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/lib/netapi/cm.c

    r740 r988  
    1919
    2020#include "includes.h"
    21 #include "popt_common.h"
     21#include "auth_info.h"
    2222
    2323#include "lib/netapi/netapi.h"
     
    2525#include "libsmb/libsmb.h"
    2626#include "rpc_client/cli_pipe.h"
     27#include "../libcli/smb/smbXcli_base.h"
    2728
    2829/********************************************************************
     
    4950
    5051        for (p = priv_ctx->ipc_connections; p; p = p->next) {
    51                 if (strequal(p->cli->desthost, server_name)) {
     52                const char *remote_name = smbXcli_conn_remote_name(p->cli->conn);
     53
     54                if (strequal(remote_name, server_name)) {
    5255                        return p;
    5356                }
     
    6467                                            struct client_ipc_connection **pp)
    6568{
    66         struct libnetapi_private_ctx *priv_ctx =
    67                 (struct libnetapi_private_ctx *)ctx->private_data;
     69        struct libnetapi_private_ctx *priv_ctx;
    6870        struct user_auth_info *auth_info = NULL;
    6971        struct cli_state *cli_ipc = NULL;
    7072        struct client_ipc_connection *p;
     73        NTSTATUS status;
    7174
    7275        if (!ctx || !pp || !server_name) {
    7376                return WERR_INVALID_PARAM;
    7477        }
     78
     79        priv_ctx = (struct libnetapi_private_ctx *)ctx->private_data;
    7580
    7681        p = ipc_cm_find(priv_ctx, server_name);
     
    8489                return WERR_NOMEM;
    8590        }
    86         auth_info->signing_state = Undefined;
     91        auth_info->signing_state = SMB_SIGNING_IPC_DEFAULT;
    8792        set_cmdline_auth_info_use_kerberos(auth_info, ctx->use_kerberos);
    8893        set_cmdline_auth_info_username(auth_info, ctx->username);
     
    103108        }
    104109
    105         cli_ipc = cli_cm_open(ctx, NULL,
    106                                 server_name, "IPC$",
    107                                 auth_info,
    108                                 false, false,
    109                                 PROTOCOL_NT1,
    110                                 0, 0x20);
    111         if (cli_ipc) {
    112                 cli_set_username(cli_ipc, ctx->username);
    113                 cli_set_password(cli_ipc, ctx->password);
    114                 cli_set_domain(cli_ipc, ctx->workgroup);
     110        status = cli_cm_open(ctx, NULL,
     111                             server_name, "IPC$",
     112                             auth_info,
     113                             false, false,
     114                             lp_client_max_protocol(),
     115                             0, 0x20, &cli_ipc);
     116        if (!NT_STATUS_IS_OK(status)) {
     117                cli_ipc = NULL;
    115118        }
    116119        TALLOC_FREE(auth_info);
     
    122125        }
    123126
    124         p = TALLOC_ZERO_P(ctx, struct client_ipc_connection);
     127        p = talloc_zero(ctx, struct client_ipc_connection);
    125128        if (p == NULL) {
    126129                return WERR_NOMEM;
     
    155158
    156159static NTSTATUS pipe_cm_find(struct client_ipc_connection *ipc,
    157                              const struct ndr_syntax_id *interface,
     160                             const struct ndr_interface_table *table,
    158161                             struct rpc_pipe_client **presult)
    159162{
     
    161164
    162165        for (p = ipc->pipe_connections; p; p = p->next) {
    163 
    164                 if (!rpc_pipe_np_smb_conn(p->pipe)) {
     166                const char *ipc_remote_name;
     167
     168                if (!rpccli_is_connected(p->pipe)) {
    165169                        return NT_STATUS_PIPE_EMPTY;
    166170                }
    167171
    168                 if (strequal(ipc->cli->desthost, p->pipe->desthost)
     172                ipc_remote_name = smbXcli_conn_remote_name(ipc->cli->conn);
     173
     174                if (strequal(ipc_remote_name, p->pipe->desthost)
    169175                    && ndr_syntax_id_equal(&p->pipe->abstract_syntax,
    170                                            interface)) {
     176                                           &table->syntax_id)) {
    171177                        *presult = p->pipe;
    172178                        return NT_STATUS_OK;
     
    182188static NTSTATUS pipe_cm_connect(TALLOC_CTX *mem_ctx,
    183189                                struct client_ipc_connection *ipc,
    184                                 const struct ndr_syntax_id *interface,
     190                                const struct ndr_interface_table *table,
    185191                                struct rpc_pipe_client **presult)
    186192{
     
    188194        NTSTATUS status;
    189195
    190         p = TALLOC_ZERO_ARRAY(mem_ctx, struct client_pipe_connection, 1);
     196        p = talloc_zero_array(mem_ctx, struct client_pipe_connection, 1);
    191197        if (!p) {
    192198                return NT_STATUS_NO_MEMORY;
    193199        }
    194200
    195         status = cli_rpc_pipe_open_noauth(ipc->cli, interface, &p->pipe);
     201        status = cli_rpc_pipe_open_noauth(ipc->cli, table, &p->pipe);
    196202        if (!NT_STATUS_IS_OK(status)) {
    197203                TALLOC_FREE(p);
     
    210216static NTSTATUS pipe_cm_open(TALLOC_CTX *ctx,
    211217                             struct client_ipc_connection *ipc,
    212                              const struct ndr_syntax_id *interface,
     218                             const struct ndr_interface_table *table,
    213219                             struct rpc_pipe_client **presult)
    214220{
    215         if (NT_STATUS_IS_OK(pipe_cm_find(ipc, interface, presult))) {
     221        if (NT_STATUS_IS_OK(pipe_cm_find(ipc, table, presult))) {
    216222                return NT_STATUS_OK;
    217223        }
    218224
    219         return pipe_cm_connect(ctx, ipc, interface, presult);
     225        return pipe_cm_connect(ctx, ipc, table, presult);
    220226}
    221227
     
    225231WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
    226232                           const char *server_name,
    227                            const struct ndr_syntax_id *interface,
     233                           const struct ndr_interface_table *table,
    228234                           struct rpc_pipe_client **presult)
    229235{
     
    242248        }
    243249
    244         status = pipe_cm_open(ctx, ipc, interface, &result);
     250        status = pipe_cm_open(ctx, ipc, table, &result);
    245251        if (!NT_STATUS_IS_OK(status)) {
    246252                libnetapi_set_error_string(ctx, "failed to open PIPE %s: %s",
    247                         get_pipe_name_from_syntax(talloc_tos(), interface),
     253                        table->name,
    248254                        get_friendly_nt_error_msg(status));
    249255                return WERR_DEST_NOT_FOUND;
     
    260266WERROR libnetapi_get_binding_handle(struct libnetapi_ctx *ctx,
    261267                                    const char *server_name,
    262                                     const struct ndr_syntax_id *interface,
     268                                    const struct ndr_interface_table *table,
    263269                                    struct dcerpc_binding_handle **binding_handle)
    264270{
     
    268274        *binding_handle = NULL;
    269275
    270         result = libnetapi_open_pipe(ctx, server_name, interface, &pipe_cli);
     276        result = libnetapi_open_pipe(ctx, server_name, table, &pipe_cli);
    271277        if (!W_ERROR_IS_OK(result)) {
    272278                return result;
  • vendor/current/source3/lib/netapi/examples/common.c

    r414 r988  
    66#include <popt.h>
    77#include <netapi.h>
     8
     9#include "common.h"
    810
    911void popt_common_callback(poptContext con,
  • vendor/current/source3/lib/netapi/examples/common.h

    r414 r988  
    88extern struct poptOption popt_common_netapi_examples[];
    99
     10#ifndef POPT_TABLEEND
     11#define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
     12#endif
     13
    1014#define POPT_COMMON_LIBNETAPI_EXAMPLES { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_netapi_examples, 0, "Common samba netapi example options:", NULL },
    1115
  • vendor/current/source3/lib/netapi/examples/join/getjoininformation.c

    r414 r988  
    1818 */
    1919
     20#include "replace.h"
    2021#include <string.h>
    2122#include <stdio.h>
     
    3132        NET_API_STATUS status;
    3233        const char *host_name = NULL;
    33         const char *name_buffer = NULL;
     34        char *name_buffer = NULL;
     35        const char *p = NULL;
    3436        uint16_t name_type = 0;
    3537        struct libnetapi_ctx *ctx = NULL;
     
    6365        /* NetGetJoinInformation */
    6466
    65         status = NetGetJoinInformation(host_name,
    66                                        &name_buffer,
    67                                        &name_type);
     67        status = NetGetJoinInformation(host_name, &p, &name_type);
     68        name_buffer = discard_const_p(char, p);
    6869        if (status != 0) {
    6970                printf("failed with: %s\n",
     
    9798
    9899 out:
    99         NetApiBufferFree((void *)name_buffer);
     100        NetApiBufferFree(name_buffer);
    100101        libnetapi_free(ctx);
    101102        poptFreeContext(pc);
  • vendor/current/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c

    r740 r988  
    11721172        gtk_container_add(GTK_CONTAINER(window), box1);
    11731173
    1174         label = gtk_label_new("You can change the name and membership of this computer. Changes may affect access to network ressources.");
     1174        label = gtk_label_new("You can change the name and membership of this computer. Changes may affect access to network resources.");
    11751175        gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
    11761176        gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
  • vendor/current/source3/lib/netapi/examples/netlogon/netlogon_control2.c

    r414 r988  
    4040        struct NETLOGON_INFO_3 *i3 = NULL;
    4141        struct NETLOGON_INFO_4 *i4 = NULL;
    42         const char *domain = NULL;
     42        char *domain = NULL;
    4343
    4444        poptContext pc;
     
    7676        }
    7777
    78         domain = "TEST";
     78        domain = strdup("TEST");
    7979
    8080        /* I_NetLogonControl2 */
  • vendor/current/source3/lib/netapi/examples/netlogon/nltest.c

    r740 r988  
    150150        if (flags & DS_FULL_SECRET_DOMAIN_6_FLAG)
    151151                printf("FULL_SECRET ");
    152         /* "WS" */
     152        if (flags & DS_WS_FLAG)
     153                printf("WS ");
     154        if (flags & DS_DS_8_FLAG)
     155                printf("DS_8 ");
    153156        printf("\n");
    154157}
     
    287290                                                    NETLOGON_CONTROL_SET_DBFLAG,
    288291                                                    query_level,
    289                                                     (uint8_t *)opt_dbflag,
     292                                                    (uint8_t *)&opt_dbflag,
    290293                                                    &buffer);
    291294                        if (status != 0) {
  • vendor/current/source3/lib/netapi/examples/server/server_getinfo.c

    r414 r988  
    3939        struct SERVER_INFO_101 *i101;
    4040        struct SERVER_INFO_102 *i102;
    41         struct SERVER_INFO_402 *i402;
    42         struct SERVER_INFO_403 *i403;
    43         struct SERVER_INFO_502 *i502;
    44         struct SERVER_INFO_503 *i503;
    4541        struct SERVER_INFO_1005 *i1005;
    4642
     
    118114                        break;
    119115                case 402:
    120                         i402 = (struct SERVER_INFO_402 *)buffer;
    121116                        break;
    122117                case 403:
    123                         i403 = (struct SERVER_INFO_403 *)buffer;
    124118                        break;
    125119                case 502:
    126                         i502 = (struct SERVER_INFO_502 *)buffer;
    127120                        break;
    128121                case 503:
    129                         i503 = (struct SERVER_INFO_503 *)buffer;
    130122                        break;
    131123                case 1005:
  • vendor/current/source3/lib/netapi/examples/share/share_add.c

    r414 r988  
    3535        const char *sharename = NULL;
    3636        const char *path = NULL;
    37         uint32_t level = 0;
    3837        uint32_t parm_err = 0;
    3938
     
    7877        path = poptGetArg(pc);
    7978
    80         if (poptPeekArg(pc)) {
    81                 level = atoi(poptGetArg(pc));
    82         }
    83 
    8479        /* NetShareAdd */
    8580
  • vendor/current/source3/lib/netapi/examples/user/user_modalsset.c

    r414 r988  
    3535        uint8_t *buffer = NULL;
    3636        uint32_t level = 0;
    37         uint32_t value = 0;
    3837        uint32_t parm_err = 0;
    3938
    4039        struct USER_MODALS_INFO_0 u0;
    41         struct USER_MODALS_INFO_1 u1;
    42         struct USER_MODALS_INFO_2 u2;
    43         struct USER_MODALS_INFO_3 u3;
    4440        struct USER_MODALS_INFO_1001 u1001;
    4541        struct USER_MODALS_INFO_1002 u1002;
     
    4743        struct USER_MODALS_INFO_1004 u1004;
    4844        struct USER_MODALS_INFO_1005 u1005;
    49         struct USER_MODALS_INFO_1006 u1006;
    50         struct USER_MODALS_INFO_1007 u1007;
    5145
    5246        poptContext pc;
     
    7872        if (poptPeekArg(pc)) {
    7973                level = atoi(poptGetArg(pc));
    80         }
    81 
    82         if (poptPeekArg(pc)) {
    83                 value = atoi(poptGetArg(pc));
    8474        }
    8575
  • vendor/current/source3/lib/netapi/examples/user/user_setinfo.c

    r414 r988  
    4040
    4141        struct USER_INFO_0 u0;
    42         struct USER_INFO_1 u1;
    43         struct USER_INFO_2 u2;
    44         struct USER_INFO_3 u3;
    45         struct USER_INFO_4 u4;
    46         struct USER_INFO_21 u21;
    47         struct USER_INFO_22 u22;
    4842        struct USER_INFO_1003 u1003;
    4943        struct USER_INFO_1005 u1005;
     
    5751        struct USER_INFO_1014 u1014;
    5852        struct USER_INFO_1017 u1017;
    59         struct USER_INFO_1020 u1020;
    6053        struct USER_INFO_1024 u1024;
    6154        struct USER_INFO_1051 u1051;
  • vendor/current/source3/lib/netapi/file.c

    r740 r988  
    3737
    3838        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    39                                             &ndr_table_srvsvc.syntax_id,
     39                                            &ndr_table_srvsvc,
    4040                                            &b);
    4141        if (!W_ERROR_IS_OK(werr)) {
     
    131131
    132132        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    133                                             &ndr_table_srvsvc.syntax_id,
     133                                            &ndr_table_srvsvc,
    134134                                            &b);
    135135        if (!W_ERROR_IS_OK(werr)) {
     
    202202
    203203        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    204                                             &ndr_table_srvsvc.syntax_id,
     204                                            &ndr_table_srvsvc,
    205205                                            &b);
    206206        if (!W_ERROR_IS_OK(werr)) {
     
    241241
    242242        for (i=0; i < info_ctr.ctr.ctr2->count; i++) {
    243                 union srvsvc_NetFileInfo _i;
     243                union srvsvc_NetFileInfo _i = {0};
    244244                switch (r->in.level) {
    245245                        case 2:
  • vendor/current/source3/lib/netapi/getdc.c

    r740 r988  
    4444        WERROR werr;
    4545        struct dcerpc_binding_handle *b;
     46        const char *dcname;
     47        void *buffer;
    4648
    4749        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    48                                             &ndr_table_netlogon.syntax_id,
     50                                            &ndr_table_netlogon,
    4951                                            &b);
    5052        if (!W_ERROR_IS_OK(werr)) {
     
    5557                                       r->in.server_name,
    5658                                       r->in.domain_name,
    57                                        (const char **)r->out.buffer,
     59                                       &dcname,
    5860                                       &werr);
    5961
    6062        if (!NT_STATUS_IS_OK(status)) {
    6163                werr = ntstatus_to_werror(status);
    62         }
     64                goto done;
     65        }
     66
     67        if (!W_ERROR_IS_OK(werr)) {
     68                goto done;
     69        }
     70
     71        if (NetApiBufferAllocate(strlen_m_term(dcname), &buffer)) {
     72                werr = WERR_NOMEM;
     73                goto done;
     74        }
     75        memcpy(buffer, dcname, strlen_m_term(dcname));
     76        *r->out.buffer = buffer;
    6377 done:
    6478
     
    8498        WERROR werr;
    8599        struct dcerpc_binding_handle *b;
     100        const char *dcname;
     101        void *buffer;
    86102
    87103        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    88                                             &ndr_table_netlogon.syntax_id,
     104                                            &ndr_table_netlogon,
    89105                                            &b);
    90106        if (!W_ERROR_IS_OK(werr)) {
     
    95111                                          r->in.server_name,
    96112                                          r->in.domain_name,
    97                                           (const char **)r->out.buffer,
     113                                          &dcname,
    98114                                          &werr);
    99115        if (!NT_STATUS_IS_OK(status)) {
     
    101117                goto done;
    102118        }
     119
     120        if (!W_ERROR_IS_OK(werr)) {
     121                goto done;
     122        }
     123
     124        if (NetApiBufferAllocate(strlen_m_term(dcname), &buffer)) {
     125                werr = WERR_NOMEM;
     126                goto done;
     127        }
     128        memcpy(buffer, dcname, strlen_m_term(dcname));
     129        *r->out.buffer = buffer;
     130
    103131 done:
    104132
     
    146174
    147175        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    148                                             &ndr_table_netlogon.syntax_id,
     176                                            &ndr_table_netlogon,
    149177                                            &b);
    150178        if (!W_ERROR_IS_OK(werr)) {
  • vendor/current/source3/lib/netapi/group.c

    r860 r988  
    7777
    7878        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    79                                    &ndr_table_samr.syntax_id,
     79                                   &ndr_table_samr,
    8080                                   &pipe_cli);
    8181        if (!W_ERROR_IS_OK(werr)) {
     
    273273
    274274        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    275                                    &ndr_table_samr.syntax_id,
     275                                   &ndr_table_samr,
    276276                                   &pipe_cli);
    277277        if (!W_ERROR_IS_OK(werr)) {
     
    493493
    494494        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    495                                    &ndr_table_samr.syntax_id,
     495                                   &ndr_table_samr,
    496496                                   &pipe_cli);
    497497        if (!W_ERROR_IS_OK(werr)) {
     
    771771
    772772        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    773                                    &ndr_table_samr.syntax_id,
     773                                   &ndr_table_samr,
    774774                                   &pipe_cli);
    775775        if (!W_ERROR_IS_OK(werr)) {
     
    919919
    920920        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    921                                    &ndr_table_samr.syntax_id,
     921                                   &ndr_table_samr,
    922922                                   &pipe_cli);
    923923        if (!W_ERROR_IS_OK(werr)) {
     
    10791079
    10801080        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    1081                                    &ndr_table_samr.syntax_id,
     1081                                   &ndr_table_samr,
    10821082                                   &pipe_cli);
    10831083        if (!W_ERROR_IS_OK(werr)) {
     
    12231223        int i;
    12241224
    1225         g0 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_0, groups->count);
     1225        g0 = talloc_zero_array(mem_ctx, struct GROUP_INFO_0, groups->count);
    12261226        W_ERROR_HAVE_NO_MEMORY(g0);
    12271227
     
    12491249        int i;
    12501250
    1251         g1 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_1, groups->count);
     1251        g1 = talloc_zero_array(mem_ctx, struct GROUP_INFO_1, groups->count);
    12521252        W_ERROR_HAVE_NO_MEMORY(g1);
    12531253
     
    12771277        int i;
    12781278
    1279         g2 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_2, groups->count);
     1279        g2 = talloc_zero_array(mem_ctx, struct GROUP_INFO_2, groups->count);
    12801280        W_ERROR_HAVE_NO_MEMORY(g2);
    12811281
     
    13081308        int i;
    13091309
    1310         g3 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_3, groups->count);
     1310        g3 = talloc_zero_array(mem_ctx, struct GROUP_INFO_3, groups->count);
    13111311        W_ERROR_HAVE_NO_MEMORY(g3);
    13121312
     
    13981398
    13991399        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    1400                                    &ndr_table_samr.syntax_id,
     1400                                   &ndr_table_samr,
    14011401                                   &pipe_cli);
    14021402        if (!W_ERROR_IS_OK(werr)) {
     
    15251525        ZERO_STRUCT(connect_handle);
    15261526        ZERO_STRUCT(domain_handle);
     1527        ZERO_STRUCT(group_handle);
    15271528
    15281529        if (!r->out.buffer) {
     
    15441545
    15451546        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    1546                                    &ndr_table_samr.syntax_id,
     1547                                   &ndr_table_samr,
    15471548                                   &pipe_cli);
    15481549        if (!W_ERROR_IS_OK(werr)) {
     
    17211722        ZERO_STRUCT(connect_handle);
    17221723        ZERO_STRUCT(domain_handle);
     1724        ZERO_STRUCT(group_handle);
    17231725
    17241726        if (!r->in.buffer) {
     
    17351737
    17361738        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    1737                                    &ndr_table_samr.syntax_id,
     1739                                   &ndr_table_samr,
    17381740                                   &pipe_cli);
    17391741        if (!W_ERROR_IS_OK(werr)) {
  • vendor/current/source3/lib/netapi/joindomain.c

    r740 r988  
    116116        DATA_BLOB session_key;
    117117
     118        if (IS_DC) {
     119                return WERR_SETUP_DOMAIN_CONTROLLER;
     120        }
     121
    118122        werr = libnetapi_open_pipe(ctx, r->in.server,
    119                                    &ndr_table_wkssvc.syntax_id,
     123                                   &ndr_table_wkssvc,
    120124                                   &pipe_cli);
    121125        if (!W_ERROR_IS_OK(werr)) {
     
    258262
    259263        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    260                                    &ndr_table_wkssvc.syntax_id,
     264                                   &ndr_table_wkssvc,
    261265                                   &pipe_cli);
    262266        if (!W_ERROR_IS_OK(werr)) {
     
    314318
    315319        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    316                                    &ndr_table_wkssvc.syntax_id,
     320                                   &ndr_table_wkssvc,
    317321                                   &pipe_cli);
    318322        if (!W_ERROR_IS_OK(werr)) {
     
    388392                         DS_RETURN_DNS_NAME;
    389393        struct libnetapi_private_ctx *priv;
     394        char **p;
     395        size_t s;
    390396
    391397        priv = talloc_get_type_abort(ctx->private_data,
     
    427433        }
    428434
    429         ads_status = ads_get_joinable_ous(ads, ctx,
    430                                           (char ***)r->out.ous,
    431                                           (size_t *)r->out.ou_count);
     435        ads_status = ads_get_joinable_ous(ads, ctx, &p, &s);
    432436        if (!ADS_ERR_OK(ads_status)) {
    433437                ads_destroy(&ads);
    434438                return WERR_DEFAULT_JOIN_REQUIRED;
    435439        }
     440        *r->out.ous = discard_const_p(const char *, p);
     441        *r->out.ou_count = s;
    436442
    437443        ads_destroy(&ads);
     
    456462
    457463        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    458                                    &ndr_table_wkssvc.syntax_id,
     464                                   &ndr_table_wkssvc,
    459465                                   &pipe_cli);
    460466        if (!W_ERROR_IS_OK(werr)) {
     
    509515
    510516        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    511                                    &ndr_table_wkssvc.syntax_id,
     517                                   &ndr_table_wkssvc,
    512518                                   &pipe_cli);
    513519        if (!W_ERROR_IS_OK(werr)) {
  • vendor/current/source3/lib/netapi/libnetapi.c

    r740 r988  
    375375
    376376/****************************************************************
     377 NetWkstaGetInfo
     378****************************************************************/
     379
     380NET_API_STATUS NetWkstaGetInfo(const char * wksta_name /* [in] [unique] */,
     381                                uint32_t level /* [in] */,
     382                                uint8_t **buffer /* [out] [ref] */)
     383{
     384        struct NetWkstaGetInfo r;
     385        struct libnetapi_ctx *ctx = NULL;
     386        NET_API_STATUS status;
     387        WERROR werr;
     388        TALLOC_CTX *frame = talloc_stackframe();
     389
     390        status = libnetapi_getctx(&ctx);
     391        if (status != 0) {
     392                TALLOC_FREE(frame);
     393                return status;
     394        }
     395
     396        /* In parameters */
     397        r.in.server_name = wksta_name;
     398        r.in.level = level;
     399
     400        /* Out parameters */
     401        r.out.buffer = buffer;
     402
     403        if (DEBUGLEVEL >= 10) {
     404                NDR_PRINT_IN_DEBUG(NetWkstaGetInfo, &r);
     405        }
     406
     407        if (LIBNETAPI_LOCAL_SERVER(wksta_name)) {
     408                werr = NetWkstaGetInfo_l(ctx, &r);
     409        } else {
     410                werr = NetWkstaGetInfo_r(ctx, &r);
     411        }
     412
     413        r.out.result = W_ERROR_V(werr);
     414
     415        if (DEBUGLEVEL >= 10) {
     416                NDR_PRINT_OUT_DEBUG(NetWkstaGetInfo, &r);
     417        }
     418
     419        TALLOC_FREE(frame);
     420        return (NET_API_STATUS)r.out.result;
     421}
     422
     423/****************************************************************
    377424 NetGetDCName
    378425****************************************************************/
  • vendor/current/source3/lib/netapi/libnetapi.h

    r740 r988  
    7979WERROR NetServerSetInfo_l(struct libnetapi_ctx *ctx,
    8080                          struct NetServerSetInfo *r);
     81NET_API_STATUS NetWkstaGetInfo(const char * wksta_name /* [in] [unique] */,
     82                                uint32_t level /* [in] */,
     83                                uint8_t **buffer /* [out] [ref] */);
     84WERROR NetWkstaGetInfo_r(struct libnetapi_ctx *ctx,
     85                         struct NetWkstaGetInfo *r);
     86WERROR NetWkstaGetInfo_l(struct libnetapi_ctx *ctx,
     87                         struct NetWkstaGetInfo *r);
    8188NET_API_STATUS NetGetDCName(const char * server_name /* [in] [unique] */,
    8289                            const char * domain_name /* [in] [unique] */,
  • vendor/current/source3/lib/netapi/localgroup.c

    r860 r988  
    166166        }
    167167
     168        ZERO_STRUCT(connect_handle);
     169        ZERO_STRUCT(builtin_handle);
     170        ZERO_STRUCT(domain_handle);
     171        ZERO_STRUCT(alias_handle);
     172
    168173        switch (r->in.level) {
    169174                case 0:
     
    180185        }
    181186
    182         ZERO_STRUCT(connect_handle);
    183         ZERO_STRUCT(builtin_handle);
    184         ZERO_STRUCT(domain_handle);
    185         ZERO_STRUCT(alias_handle);
    186 
    187187        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    188                                    &ndr_table_samr.syntax_id,
     188                                   &ndr_table_samr,
    189189                                   &pipe_cli);
    190190        if (!W_ERROR_IS_OK(werr)) {
     
    320320
    321321        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    322                                    &ndr_table_samr.syntax_id,
     322                                   &ndr_table_samr,
    323323                                   &pipe_cli);
    324324        if (!W_ERROR_IS_OK(werr)) {
     
    500500
    501501        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    502                                    &ndr_table_samr.syntax_id,
     502                                   &ndr_table_samr,
    503503                                   &pipe_cli);
    504504        if (!W_ERROR_IS_OK(werr)) {
     
    617617        union samr_AliasInfo *info = NULL;
    618618
    619         info = TALLOC_ZERO_P(mem_ctx, union samr_AliasInfo);
     619        info = talloc_zero(mem_ctx, union samr_AliasInfo);
    620620        W_ERROR_HAVE_NO_MEMORY(info);
    621621
     
    679679
    680680        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    681                                    &ndr_table_samr.syntax_id,
     681                                   &ndr_table_samr,
    682682                                   &pipe_cli);
    683683        if (!W_ERROR_IS_OK(werr)) {
     
    829829
    830830        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    831                                    &ndr_table_samr.syntax_id,
     831                                   &ndr_table_samr,
    832832                                   &pipe_cli);
    833833        if (!W_ERROR_IS_OK(werr)) {
     
    11221122        ZERO_STRUCT(alias_handle);
    11231123
    1124         member_sids = TALLOC_ZERO_ARRAY(ctx, struct dom_sid,
     1124        member_sids = talloc_zero_array(ctx, struct dom_sid,
    11251125                                        r->in.total_entries);
    11261126        W_ERROR_HAVE_NO_MEMORY(member_sids);
     
    11421142        if (r->in.level == 3) {
    11431143                werr = libnetapi_open_pipe(ctx, r->in.server_name,
    1144                                            &ndr_table_lsarpc.syntax_id,
     1144                                           &ndr_table_lsarpc,
    11451145                                           &lsa_pipe);
    11461146                if (!W_ERROR_IS_OK(werr)) {
     
    11611161
    11621162        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    1163                                    &ndr_table_samr.syntax_id,
     1163                                   &ndr_table_samr,
    11641164                                   &pipe_cli);
    11651165        if (!W_ERROR_IS_OK(werr)) {
  • vendor/current/source3/lib/netapi/netapi.c

    r746 r988  
    2525
    2626struct libnetapi_ctx *stat_ctx = NULL;
    27 TALLOC_CTX *frame = NULL;
    2827static bool libnetapi_initialized = false;
    2928
     
    3938        }
    4039
    41         priv = TALLOC_ZERO_P(ctx, struct libnetapi_private_ctx);
     40        priv = talloc_zero(ctx, struct libnetapi_private_ctx);
    4241        if (!priv) {
    4342                return W_ERROR_V(WERR_NOMEM);
     
    5857NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context)
    5958{
     59        NET_API_STATUS ret;
     60        TALLOC_CTX *frame;
    6061        if (stat_ctx && libnetapi_initialized) {
    6162                *context = stat_ctx;
     
    6768#endif
    6869        frame = talloc_stackframe();
    69 
    70         /* Case tables must be loaded before any string comparisons occour */
    71         load_case_tables_library();
    7270
    7371        /* When libnetapi is invoked from an application, it does not
     
    7775        setup_logging("libnetapi", DEBUG_STDERR);
    7876
    79         if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, false)) {
     77        if (!lp_load_global(get_dyn_CONFIGFILE())) {
    8078                TALLOC_FREE(frame);
    8179                fprintf(stderr, "error loading %s\n", get_dyn_CONFIGFILE() );
     
    8987        BlockSignals(True, SIGPIPE);
    9088
    91         return libnetapi_net_init(context);
     89        ret = libnetapi_net_init(context);
     90        TALLOC_FREE(frame);
     91        return ret;
    9292}
    9393
     
    104104        NET_API_STATUS status;
    105105        struct libnetapi_ctx *ctx = NULL;
    106 
    107         frame = talloc_stackframe();
     106        TALLOC_CTX *frame = talloc_stackframe();
    108107
    109108        ctx = talloc_zero(frame, struct libnetapi_ctx);
     
    116115
    117116        if (getenv("USER")) {
    118                 ctx->username = talloc_strdup(frame, getenv("USER"));
     117                ctx->username = talloc_strdup(ctx, getenv("USER"));
    119118        } else {
    120                 ctx->username = talloc_strdup(frame, "");
     119                ctx->username = talloc_strdup(ctx, "");
    121120        }
    122121        if (!ctx->username) {
     
    134133        libnetapi_initialized = true;
    135134
     135        talloc_steal(NULL, ctx);
    136136        *context = stat_ctx = ctx;
    137 
     137       
     138        TALLOC_FREE(frame);
    138139        return NET_API_STATUS_SUCCESS;
    139140}
     
    159160NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
    160161{
     162        TALLOC_CTX *frame;
     163
    161164        if (!ctx) {
    162165                return NET_API_STATUS_SUCCESS;
    163166        }
    164167
     168        frame = talloc_stackframe();
    165169        libnetapi_samr_free(ctx);
    166170
     
    176180        gfree_names();
    177181        gfree_loadparm();
    178         gfree_case_tables();
    179182        gfree_charcnv();
    180183        gfree_interfaces();
     
    182185        secrets_shutdown();
    183186
     187        if (ctx == stat_ctx) {
     188                stat_ctx = NULL;
     189        }
    184190        TALLOC_FREE(ctx);
    185         TALLOC_FREE(frame);
    186191
    187192        gfree_debugsyms();
     193        talloc_free(frame);
    188194
    189195        return NET_API_STATUS_SUCCESS;
     
    197203                                        const char *debuglevel)
    198204{
     205        TALLOC_CTX *frame = talloc_stackframe();
    199206        ctx->debuglevel = talloc_strdup(ctx, debuglevel);
     207       
    200208        if (!lp_set_cmdline("log level", debuglevel)) {
     209                TALLOC_FREE(frame);
    201210                return W_ERROR_V(WERR_GENERAL_FAILURE);
    202211        }
     212        TALLOC_FREE(frame);
    203213        return NET_API_STATUS_SUCCESS;
    204214}
     
    270280
    271281/****************************************************************
    272 ****************************************************************/
    273 
    274 const char *libnetapi_errstr(NET_API_STATUS status)
    275 {
     282Return a libnetapi error as a string, caller must free with NetApiBufferFree
     283****************************************************************/
     284
     285char *libnetapi_errstr(NET_API_STATUS status)
     286{
     287        TALLOC_CTX *frame = talloc_stackframe();
     288        char *ret;
    276289        if (status & 0xc0000000) {
    277                 return get_friendly_nt_error_msg(NT_STATUS(status));
    278         }
    279 
    280         return get_friendly_werror_msg(W_ERROR(status));
     290                ret = talloc_strdup(NULL,
     291                                     get_friendly_nt_error_msg(NT_STATUS(status)));
     292        } else {
     293                ret = talloc_strdup(NULL,
     294                                    get_friendly_werror_msg(W_ERROR(status)));
     295        }
     296        TALLOC_FREE(frame);
     297        return ret;
    281298}
    282299
     
    302319
    303320/****************************************************************
    304 ****************************************************************/
    305 
    306 const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
     321Return a libnetapi_errstr(), caller must free with NetApiBufferFree
     322****************************************************************/
     323
     324char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
    307325                                       NET_API_STATUS status_in)
    308326{
     
    318336
    319337        if (tmp_ctx->error_string) {
    320                 return tmp_ctx->error_string;
     338                return talloc_strdup(NULL, tmp_ctx->error_string);
    321339        }
    322340
  • vendor/current/source3/lib/netapi/netapi.h

    r740 r988  
    12341234};
    12351235
     1236struct SHARE_INFO_502 {
     1237        const char * shi502_netname;
     1238        uint32_t shi502_type;
     1239        const char * shi502_remark;
     1240        uint32_t shi502_permissions;
     1241        uint32_t shi502_max_uses;
     1242        uint32_t shi502_current_uses;
     1243        const char * shi502_path;
     1244        const char * shi502_passwd;
     1245        uint32_t shi502_reserved;
     1246        struct security_descriptor * shi502_security_descriptor;
     1247};
     1248
    12361249struct SHARE_INFO_1004 {
    12371250        const char * shi1004_remark;
     
    12971310#define DS_SELECT_SECRET_DOMAIN_6_FLAG ( 0x00000800 )
    12981311#define DS_FULL_SECRET_DOMAIN_6_FLAG ( 0x00001000 )
     1312#define DS_WS_FLAG ( 0x00002000 )
     1313#define DS_DS_8_FLAG ( 0x00004000 )
    12991314#define DS_DNS_CONTROLLER_FLAG ( 0x20000000 )
    13001315#define DS_DNS_DOMAIN_FLAG ( 0x40000000 )
     
    14121427
    14131428/****************************************************************
     1429Return a specific libnetapi error as a string, caller must free with NetApiBufferFree
    14141430****************************************************************/
    14151431
    1416 const char *libnetapi_errstr(NET_API_STATUS status);
     1432char *libnetapi_errstr(NET_API_STATUS status);
    14171433
    14181434/****************************************************************
     1435Return the last libnetapi error as a string, caller must free with NetApiBufferFree
     1436ctx is optional
    14191437****************************************************************/
    14201438
    1421 const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
    1422                                        NET_API_STATUS status);
     1439char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
     1440                                 NET_API_STATUS status);
    14231441
    14241442/****************************************************************
     
    16121630                                uint8_t *buffer /* [in] [ref] */,
    16131631                                uint32_t *parm_error /* [out] [ref] */);
     1632
     1633/************************************************************//**
     1634 *
     1635 * NetWkstaGetInfo
     1636 *
     1637 * @brief Get Information on a workstation
     1638 *
     1639 * @param[in] wksta_name The workstation name to connect to
     1640 * @param[in] level The level to define which information is requested
     1641 * @param[out] buffer The returned buffer carrying the WKSTA_INFO structure
     1642 * @return NET_API_STATUS
     1643 *
     1644 ***************************************************************/
     1645
     1646NET_API_STATUS NetWkstaGetInfo(const char * wksta_name /* [in] */,
     1647                                uint32_t level /* [in] */,
     1648                                uint8_t **buffer /* [out] [ref] */);
    16141649
    16151650/************************************************************//**
  • vendor/current/source3/lib/netapi/netapi_private.h

    r740 r988  
    3131
    3232struct dcerpc_binding_handle;
     33struct ndr_interface_table;
    3334
    3435struct libnetapi_private_ctx {
     
    6162WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
    6263                           const char *server_name,
    63                            const struct ndr_syntax_id *interface,
     64                           const struct ndr_interface_table *table,
    6465                           struct rpc_pipe_client **presult);
    6566WERROR libnetapi_get_binding_handle(struct libnetapi_ctx *ctx,
    6667                                    const char *server_name,
    67                                     const struct ndr_syntax_id *interface,
     68                                    const struct ndr_interface_table *table,
    6869                                    struct dcerpc_binding_handle **binding_handle);
    6970WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx,
  • vendor/current/source3/lib/netapi/netlogon.c

    r740 r988  
    134134
    135135        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    136                                             &ndr_table_netlogon.syntax_id,
     136                                            &ndr_table_netlogon,
    137137                                            &b);
    138138        if (!W_ERROR_IS_OK(werr)) {
     
    191191
    192192        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    193                                             &ndr_table_netlogon.syntax_id,
     193                                            &ndr_table_netlogon,
    194194                                            &b);
    195195        if (!W_ERROR_IS_OK(werr)) {
  • vendor/current/source3/lib/netapi/samr.c

    r740 r988  
    4646        const char *domain_name = NULL;
    4747        struct lsa_String lsa_domain_name;
    48         bool domain_found = true;
     48        bool domain_found = false;
    4949        int i;
    5050        struct dcerpc_binding_handle *b = pipe_cli->binding_handle;
     
    241241                                        connect_handle,
    242242                                        builtin_mask,
    243                                         CONST_DISCARD(struct dom_sid *, &global_sid_Builtin),
     243                                        discard_const_p(struct dom_sid, &global_sid_Builtin),
    244244                                        builtin_handle,
    245245                                        &result);
     
    284284                struct libnetapi_private_ctx);
    285285
    286         if (!policy_handle_equal(handle, &priv->samr.domain_handle)) {
     286        if (!ndr_policy_handle_equal(handle, &priv->samr.domain_handle)) {
    287287                return;
    288288        }
     
    312312                struct libnetapi_private_ctx);
    313313
    314         if (!policy_handle_equal(handle, &priv->samr.builtin_handle)) {
     314        if (!ndr_policy_handle_equal(handle, &priv->samr.builtin_handle)) {
    315315                return;
    316316        }
     
    340340                struct libnetapi_private_ctx);
    341341
    342         if (!policy_handle_equal(handle, &priv->samr.connect_handle)) {
     342        if (!ndr_policy_handle_equal(handle, &priv->samr.connect_handle)) {
    343343                return;
    344344        }
  • vendor/current/source3/lib/netapi/serverinfo.c

    r740 r988  
    3737
    3838        i.sv101_platform_id     = PLATFORM_ID_NT;
    39         i.sv101_name            = global_myname();
    40         i.sv101_version_major   = lp_major_announce_version();
    41         i.sv101_version_minor   = lp_minor_announce_version();
     39        i.sv101_name            = lp_netbios_name();
     40        i.sv101_version_major   = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION;
     41        i.sv101_version_minor   = SAMBA_MINOR_NBT_ANNOUNCE_VERSION;
    4242        i.sv101_type            = lp_default_server_announce();
    43         i.sv101_comment         = lp_serverstring();
     43        i.sv101_comment         = lp_server_string(ctx);
    4444
    4545        *buffer = (uint8_t *)talloc_memdup(ctx, &i, sizeof(i));
     
    5959        struct SERVER_INFO_1005 info1005;
    6060
    61         info1005.sv1005_comment = lp_serverstring();
     61        info1005.sv1005_comment = lp_server_string(ctx);
    6262        *buffer = (uint8_t *)talloc_memdup(ctx, &info1005, sizeof(info1005));
    6363        if (!*buffer) {
     
    504504
    505505        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    506                                             &ndr_table_srvsvc.syntax_id,
     506                                            &ndr_table_srvsvc,
    507507                                            &b);
    508508        if (!W_ERROR_IS_OK(werr)) {
     
    617617
    618618        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    619                                             &ndr_table_srvsvc.syntax_id,
     619                                            &ndr_table_srvsvc,
    620620                                            &b);
    621621        if (!W_ERROR_IS_OK(werr)) {
     
    659659
    660660        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    661                                             &ndr_table_srvsvc.syntax_id,
     661                                            &ndr_table_srvsvc,
    662662                                            &b);
    663663        if (!W_ERROR_IS_OK(werr)) {
  • vendor/current/source3/lib/netapi/share.c

    r740 r988  
    2525#include "lib/netapi/libnetapi.h"
    2626#include "../librpc/gen_ndr/ndr_srvsvc_c.h"
     27#include "librpc/gen_ndr/ndr_security.h"
    2728
    2829/****************************************************************
     
    130131{
    131132        struct SHARE_INFO_2 *i2 = NULL;
     133        struct SHARE_INFO_502 *i502 = NULL;
    132134        struct SHARE_INFO_1004 *i1004 = NULL;
    133135        struct srvsvc_NetShareInfo2 *s2 = NULL;
     136        struct srvsvc_NetShareInfo502 *s502 = NULL;
    134137        struct srvsvc_NetShareInfo1004 *s1004 = NULL;
    135138
     
    142145                        i2 = (struct SHARE_INFO_2 *)buffer;
    143146
    144                         s2 = TALLOC_P(mem_ctx, struct srvsvc_NetShareInfo2);
     147                        s2 = talloc(mem_ctx, struct srvsvc_NetShareInfo2);
    145148                        NT_STATUS_HAVE_NO_MEMORY(s2);
    146149
     
    157160
    158161                        break;
     162
     163                case 502:
     164                        i502 = (struct SHARE_INFO_502 *)buffer;
     165
     166                        s502 = talloc(mem_ctx, struct srvsvc_NetShareInfo502);
     167                        NT_STATUS_HAVE_NO_MEMORY(s502);
     168
     169                        s502->name              = i502->shi502_netname;
     170                        s502->type              = i502->shi502_type;
     171                        s502->comment           = i502->shi502_remark;
     172                        s502->permissions       = i502->shi502_permissions;
     173                        s502->max_users         = i502->shi502_max_uses;
     174                        s502->current_users     = i502->shi502_current_uses;
     175                        s502->path              = i502->shi502_path;
     176                        s502->password          = i502->shi502_passwd;
     177                        s502->sd_buf.sd_size    =
     178                                ndr_size_security_descriptor(i502->shi502_security_descriptor, 0);
     179                        s502->sd_buf.sd         = i502->shi502_security_descriptor;
     180
     181                        info->info502 = s502;
     182
     183                        break;
     184
    159185                case 1004:
    160186                        i1004 = (struct SHARE_INFO_1004 *)buffer;
    161187
    162                         s1004 = TALLOC_P(mem_ctx, struct srvsvc_NetShareInfo1004);
     188                        s1004 = talloc(mem_ctx, struct srvsvc_NetShareInfo1004);
    163189                        NT_STATUS_HAVE_NO_MEMORY(s1004);
    164190
     
    192218        switch (r->in.level) {
    193219                case 2:
    194                         break;
    195220                case 502:
     221                        break;
    196222                case 503:
    197223                        return WERR_NOT_SUPPORTED;
     
    201227
    202228        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    203                                             &ndr_table_srvsvc.syntax_id,
     229                                            &ndr_table_srvsvc,
    204230                                            &b);
    205231        if (!W_ERROR_IS_OK(werr)) {
     
    259285
    260286        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    261                                             &ndr_table_srvsvc.syntax_id,
     287                                            &ndr_table_srvsvc,
    262288                                            &b);
    263289        if (!W_ERROR_IS_OK(werr)) {
     
    322348
    323349        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    324                                             &ndr_table_srvsvc.syntax_id,
     350                                            &ndr_table_srvsvc,
    325351                                            &b);
    326352        if (!W_ERROR_IS_OK(werr)) {
     
    361387
    362388        for (i=0; i < info_ctr.ctr.ctr1->count; i++) {
    363                 union srvsvc_NetShareInfo _i;
     389                union srvsvc_NetShareInfo _i = {0};
    364390                switch (r->in.level) {
    365391                        case 0:
     
    429455
    430456        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    431                                             &ndr_table_srvsvc.syntax_id,
     457                                            &ndr_table_srvsvc,
    432458                                            &b);
    433459        if (!W_ERROR_IS_OK(werr)) {
     
    503529
    504530        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    505                                             &ndr_table_srvsvc.syntax_id,
     531                                            &ndr_table_srvsvc,
    506532                                            &b);
    507533        if (!W_ERROR_IS_OK(werr)) {
  • vendor/current/source3/lib/netapi/shutdown.c

    r740 r988  
    3939
    4040        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    41                                             &ndr_table_initshutdown.syntax_id,
     41                                            &ndr_table_initshutdown,
    4242                                            &b);
    4343        if (!W_ERROR_IS_OK(werr)) {
     
    8383
    8484        werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
    85                                             &ndr_table_initshutdown.syntax_id,
     85                                            &ndr_table_initshutdown,
    8686                                            &b);
    8787        if (!W_ERROR_IS_OK(werr)) {
  • vendor/current/source3/lib/netapi/tests/common.h

    r414 r988  
    2929#define POPT_COMMON_LIBNETAPI_EXAMPLES { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_netapi_examples, 0, "Common samba netapi example options:", NULL },
    3030
     31#ifndef POPT_TABLEEND
     32#define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
     33#endif
     34
    3135NET_API_STATUS test_netuseradd(const char *hostname,
    3236                               const char *username);
     
    4650NET_API_STATUS netapitest_server(struct libnetapi_ctx *ctx,
    4751                                 const char *hostname);
     52NET_API_STATUS netapitest_wksta(struct libnetapi_ctx *ctx,
     53                                const char *hostname);
    4854
    4955#ifndef ARRAY_SIZE
  • vendor/current/source3/lib/netapi/tests/netapitest.c

    r414 r988  
    9595        }
    9696
     97        status = netapitest_wksta(ctx, hostname);
     98        if (status) {
     99                goto out;
     100        }
     101
    97102 out:
    98103        if (status != 0) {
  • vendor/current/source3/lib/netapi/tests/netgroup.c

    r414 r988  
    5252                                      level,
    5353                                      &buffer,
    54                                       120, //(uint32_t)-1,
     54                                      120, /*(uint32_t)-1, */
    5555                                      &entries_read,
    5656                                      &total_entries,
     
    349349
    350350        status = NetGroupSetInfo(hostname, groupname, 0, (uint8_t *)&g0, &parm_err);
    351         switch (status) {
     351        switch ((int)status) {
    352352                case 0:
    353353                        break;
  • vendor/current/source3/lib/netapi/tests/netshare.c

    r414 r988  
    125125        uint8_t *buffer = NULL;
    126126        struct SHARE_INFO_2 i2;
     127        struct SHARE_INFO_502 i502;
    127128        struct SHARE_INFO_1004 i1004;
    128129        struct SHARE_INFO_501 *i501 = NULL;
     
    143144        printf("testing NetShareAdd\n");
    144145
     146        ZERO_STRUCT(i502);
     147
     148        i502.shi502_netname = sharename;
     149        i502.shi502_path = "c:\\";
     150
     151        status = NetShareAdd(hostname, 502, (uint8_t *)&i502, &parm_err);
     152        if (status) {
     153                NETAPI_STATUS(ctx, status, "NetShareAdd");
     154                goto out;
     155        };
     156
     157        status = NetShareDel(hostname, sharename, 0);
     158        if (status) {
     159                NETAPI_STATUS(ctx, status, "NetShareDel");
     160                goto out;
     161        };
     162
    145163        ZERO_STRUCT(i2);
    146164
  • vendor/current/source3/lib/netapi/tests/netuser.c

    r414 r988  
    5858                                     FILTER_NORMAL_ACCOUNT,
    5959                                     &buffer,
    60                                      120, //(uint32_t)-1,
     60                                     120, /*(uint32_t)-1, */
    6161                                     &entries_read,
    6262                                     &total_entries,
     
    276276                                          level,
    277277                                          &buffer,
    278                                           120, //(uint32_t)-1,
     278                                          120, /*(uint32_t)-1, */
    279279                                          &entries_read,
    280280                                          &total_entries);
  • vendor/current/source3/lib/netapi/user.c

    r860 r988  
    6969        }
    7070        if (infoX->usriX_password_age) {
    71                 fields_present |= SAMR_FIELD_FORCE_PWD_CHANGE;
     71                fields_present |= SAMR_FIELD_EXPIRED_FLAG;
    7272        }
    7373        if (infoX->usriX_full_name) {
     
    401401
    402402        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    403                                    &ndr_table_samr.syntax_id,
     403                                   &ndr_table_samr,
    404404                                   &pipe_cli);
    405405        if (!W_ERROR_IS_OK(werr)) {
     
    553553
    554554        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    555                                    &ndr_table_samr.syntax_id,
     555                                   &ndr_table_samr,
    556556                                   &pipe_cli);
    557557
     
    576576                                        &connect_handle,
    577577                                        SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT,
    578                                         CONST_DISCARD(struct dom_sid *, &global_sid_Builtin),
     578                                        discard_const_p(struct dom_sid, &global_sid_Builtin),
    579579                                        &builtin_handle,
    580580                                        &result);
     
    12021202
    12031203        switch (level) {
    1204                 case 0:
    1205                         /* already returned above */
    1206                         break;
    12071204                case 1:
    12081205                        status = info21_to_USER_INFO_1(mem_ctx, info21, &info1);
     
    13231320
    13241321        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    1325                                    &ndr_table_samr.syntax_id,
     1322                                   &ndr_table_samr,
    13261323                                   &pipe_cli);
    13271324        if (!W_ERROR_IS_OK(werr)) {
     
    14451442        int i;
    14461443
    1447         user = TALLOC_ZERO_ARRAY(mem_ctx,
     1444        user = talloc_zero_array(mem_ctx,
    14481445                                 struct NET_DISPLAY_USER,
    14491446                                 info->count);
     
    14891486        int i;
    14901487
    1491         machine = TALLOC_ZERO_ARRAY(mem_ctx,
     1488        machine = talloc_zero_array(mem_ctx,
    14921489                                    struct NET_DISPLAY_MACHINE,
    14931490                                    info->count);
     
    15311528        int i;
    15321529
    1533         group = TALLOC_ZERO_ARRAY(mem_ctx,
     1530        group = talloc_zero_array(mem_ctx,
    15341531                                  struct NET_DISPLAY_GROUP,
    15351532                                  info->count);
     
    16311628
    16321629        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    1633                                    &ndr_table_samr.syntax_id,
     1630                                   &ndr_table_samr,
    16341631                                   &pipe_cli);
    16351632        if (!W_ERROR_IS_OK(werr)) {
     
    17651762
    17661763        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    1767                                    &ndr_table_samr.syntax_id,
     1764                                   &ndr_table_samr,
    17681765                                   &pipe_cli);
    17691766        if (!W_ERROR_IS_OK(werr)) {
     
    19051902                case 1024:
    19061903                        user_mask = SAMR_USER_ACCESS_SET_LOC_COM;
     1904                        break;
    19071905                case 1051:
    19081906                        user_mask = SAMR_USER_ACCESS_SET_ATTRIBUTES |
     
    19361934
    19371935        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    1938                                    &ndr_table_samr.syntax_id,
     1936                                   &ndr_table_samr,
    19391937                                   &pipe_cli);
    19401938        if (!W_ERROR_IS_OK(werr)) {
     
    23952393
    23962394        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    2397                                    &ndr_table_samr.syntax_id,
     2395                                   &ndr_table_samr,
    23982396                                   &pipe_cli);
    23992397        if (!W_ERROR_IS_OK(werr)) {
     
    28802878
    28812879        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    2882                                    &ndr_table_samr.syntax_id,
     2880                                   &ndr_table_samr,
    28832881                                   &pipe_cli);
    28842882        if (!W_ERROR_IS_OK(werr)) {
     
    30153013
    30163014        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    3017                                    &ndr_table_samr.syntax_id,
     3015                                   &ndr_table_samr,
    30183016                                   &pipe_cli);
    30193017        if (!W_ERROR_IS_OK(werr)) {
     
    31783176
    31793177        uint32_t *member_rids = NULL;
    3180         size_t num_member_rids = 0;
    31813178
    31823179        struct GROUP_USERS_INFO_0 *i0 = NULL;
     
    31923189        ZERO_STRUCT(connect_handle);
    31933190        ZERO_STRUCT(domain_handle);
     3191        ZERO_STRUCT(group_handle);
    31943192
    31953193        if (!r->in.buffer) {
     
    32063204
    32073205        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    3208                                    &ndr_table_samr.syntax_id,
     3206                                   &ndr_table_samr,
    32093207                                   &pipe_cli);
    32103208        if (!W_ERROR_IS_OK(werr)) {
     
    33203318
    33213319        member_rids = group_rids.ids;
    3322         num_member_rids = group_rids.count;
    33233320
    33243321        status = dcerpc_samr_GetGroupsForUser(b, talloc_tos(),
     
    35483545
    35493546        werr = libnetapi_open_pipe(ctx, r->in.server_name,
    3550                                    &ndr_table_samr.syntax_id,
     3547                                   &ndr_table_samr,
    35513548                                   &pipe_cli);
    35523549        if (!W_ERROR_IS_OK(werr)) {
     
    36393636
    36403637        sid_array.num_sids = rid_array->count + 1;
    3641         sid_array.sids = TALLOC_ARRAY(ctx, struct lsa_SidPtr, sid_array.num_sids);
     3638        sid_array.sids = talloc_array(ctx, struct lsa_SidPtr, sid_array.num_sids);
    36423639        if (!sid_array.sids) {
    36433640                werr = WERR_NOMEM;
Note: See TracChangeset for help on using the changeset viewer.