Changeset 745 for trunk/server/librpc


Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
143 deleted
52 edited
33 copied

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/librpc/build_idl.sh

    r414 r745  
    1 #!/bin/sh
     1#!/@unixroot/usr/bin/sh
    22
    33if [ "$1" = "--full" ]; then
     
    88fi
    99
    10 ARGS="--outputdir $PIDL_OUTPUTDIR --header --ndr-parser --samba3-ndr-server --samba3-ndr-client --server --client --python --dcom-proxy --com-header $PIDL_ARGS --"
     10ARGS="--outputdir $PIDL_OUTPUTDIR --header --ndr-parser --samba3-ndr-server --server --client --python --dcom-proxy --com-header $PIDL_ARGS --"
    1111IDL_FILES="$*"
    1212
     
    3030list=""
    3131for f in ${IDL_FILES}; do
    32         basename=`basename $f .idl`
    33         ndr="$PIDL_OUTPUTDIR/py_$basename.c"
     32        b=`basename $f .idl`
     33        outfiles="$b.h ndr_${b}_c.c ndr_$b.h ndr_${b}_s.c srv_$b.c"
     34        outfiles="$outfiles ndr_$b.c ndr_${b}_c.h py_$b.c srv_$b.h"
    3435
    35         if [ -f $ndr ]; then
    36                 if [ "x`find $f -newer $ndr -print`" = "x$f" ]; then
    37                         list="$list $f"
    38                 fi
    39         else
     36        for o in $outfiles; do
     37            [ -f $PIDL_OUTPUTDIR/$o ] || {
    4038                list="$list $f"
    41         fi
     39                break
     40            }
     41            test "`find $f -newer $PIDL_OUTPUTDIR/$o`" != "" && {
     42                list="$list $f"
     43                break
     44            }
     45        done
    4246done
    4347
  • trunk/server/librpc/idl/dcerpc.idl

    r596 r745  
    2020        } dcerpc_ctx_list;
    2121
    22         typedef struct {
     22        typedef [public] struct {
    2323                uint16 max_xmit_frag;
    2424                uint16 max_recv_frag;
     
    2626                uint8  num_contexts;
    2727                dcerpc_ctx_list ctx_list[num_contexts];
    28                 [flag(NDR_ALIGN4)]    DATA_BLOB _pad;
    2928                [flag(NDR_REMAINING)] DATA_BLOB auth_info;
    3029        } dcerpc_bind;
     
    9796        } dcerpc_response;
    9897
     98        typedef [v1_enum] enum {
     99                DCERPC_NCA_S_COMM_FAILURE               = 0x1C010001,
     100                DCERPC_NCA_S_OP_RNG_ERROR               = 0x1C010002,
     101                DCERPC_NCA_S_UNKNOWN_IF                 = 0x1C010003,
     102                DCERPC_NCA_S_WRONG_BOOT_TIME            = 0x1C010006,
     103                DCERPC_NCA_S_YOU_CRASHED                = 0x1C010009,
     104                DCERPC_NCA_S_PROTO_ERROR                = 0x1C01000B,
     105                DCERPC_NCA_S_OUT_ARGS_TOO_BIG           = 0x1C010013,
     106                DCERPC_NCA_S_SERVER_TOO_BUSY            = 0x1C010014,
     107                DCERPC_NCA_S_FAULT_STRING_TOO_LARGE     = 0x1C010015,
     108                DCERPC_NCA_S_UNSUPPORTED_TYPE           = 0x1C010017,
     109                DCERPC_NCA_S_FAULT_INT_DIV_BY_ZERO      = 0x1C000001,
     110                DCERPC_NCA_S_FAULT_ADDR_ERROR           = 0x1C000002,
     111                DCERPC_NCA_S_FAULT_FP_DIV_BY_ZERO       = 0x1C000003,
     112                DCERPC_NCA_S_FAULT_FP_UNDERFLOW         = 0x1C000004,
     113                DCERPC_NCA_S_FAULT_FP_OVERRFLOW         = 0x1C000005,
     114                DCERPC_NCA_S_FAULT_INVALID_TAG          = 0x1C000006,
     115                DCERPC_NCA_S_FAULT_INVALID_BOUND        = 0x1C000007,
     116                DCERPC_NCA_S_FAULT_RPC_VERSION_MISMATCH = 0x1C000008,
     117                DCERPC_NCA_S_FAULT_UNSPEC_REJECT        = 0x1C000009,
     118                DCERPC_NCA_S_FAULT_BAD_ACTID            = 0x1C00000A,
     119                DCERPC_NCA_S_FAULT_WHO_ARE_YOU_FAILED   = 0x1C00000B,
     120                DCERPC_NCA_S_FAULT_MANAGER_NOT_ENTERED  = 0x1C00000C,
     121                DCERPC_NCA_S_FAULT_CANCEL               = 0x1C00000D,
     122                DCERPC_NCA_S_FAULT_ILL_INST             = 0x1C00000E,
     123                DCERPC_NCA_S_FAULT_FP_ERROR             = 0x1C00000F,
     124                DCERPC_NCA_S_FAULT_INT_OVERFLOW         = 0x1C000010,
     125                DCERPC_NCA_S_UNUSED_1C000011            = 0x1C000011,
     126                DCERPC_NCA_S_FAULT_UNSPEC               = 0x1C000012,
     127                DCERPC_NCA_S_FAULT_REMOTE_COMM_FAILURE  = 0x1C000013,
     128                DCERPC_NCA_S_FAULT_PIPE_EMPTY           = 0x1C000014,
     129                DCERPC_NCA_S_FAULT_PIPE_CLOSED          = 0x1C000015,
     130                DCERPC_NCA_S_FAULT_PIPE_ORDER           = 0x1C000016,
     131                DCERPC_NCA_S_FAULT_PIPE_DISCIPLINE      = 0x1C000017,
     132                DCERPC_NCA_S_FAULT_PIPE_COMM_ERROR      = 0x1C000018,
     133                DCERPC_NCA_S_FAULT_PIPE_MEMORY          = 0x1C000019,
     134                DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH     = 0x1C00001A,
     135                DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY     = 0x1C00001B,
     136                DCERPC_NCA_S_INVALID_PRES_CONTEXT_ID    = 0x1C00001C,
     137                DCERPC_NCA_S_UNSUPPORTED_AUTHN_LEVEL    = 0x1C00001D,
     138                DCERPC_NCA_S_UNUSED_1C00001E            = 0x1C00001E,
     139                DCERPC_NCA_S_INVALID_CHECKSUM           = 0x1C00001F,
     140                DCERPC_NCA_S_INVALID_CRC                = 0x1C000020,
     141                DCERPC_NCA_S_FAULT_USER_DEFINED         = 0x1C000021,
     142                DCERPC_NCA_S_FAULT_TX_OPEN_FAILED       = 0x1C000022,
     143                DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR   = 0x1C000023,
     144                DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND     = 0x1C000024,
     145                DCERPC_NCA_S_FAULT_NO_CLIENT_STUB       = 0x1C000025
     146        } dcerpc_nca_status;
    99147
    100148        const int DCERPC_FAULT_OP_RNG_ERROR       = 0x1c010002;
     
    116164                uint16 context_id;
    117165                uint8 cancel_count;
    118                 uint32 status;
     166                dcerpc_nca_status status;
    119167                [flag(NDR_REMAINING)] DATA_BLOB _pad;
    120168        } dcerpc_fault;
     
    132180                DCERPC_AUTH_TYPE_DIGEST   = 21,
    133181                DCERPC_AUTH_TYPE_SCHANNEL = 68,
    134                 DCERPC_AUTH_TYPE_MSMQ     = 100
     182                DCERPC_AUTH_TYPE_MSMQ     = 100,
     183                DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM = 200
    135184        } dcerpc_AuthType;
    136185
     
    158207
    159208        typedef [public] struct {
    160                 uint32 _pad;
     209                [value(0)]            uint32    _pad;
    161210                [flag(NDR_REMAINING)] DATA_BLOB auth_info;
    162211        } dcerpc_auth3;
    163212
    164213        typedef [public] struct {
    165                 uint32 _pad;
     214                [value(0)]            uint32    _pad;
    166215                [flag(NDR_REMAINING)] DATA_BLOB auth_info;
    167216        } dcerpc_orphaned;
    168217
    169218        typedef [public] struct {
    170                 uint32 _pad;
     219                [value(0)]            uint32    _pad;
    171220                [flag(NDR_REMAINING)] DATA_BLOB auth_info;
    172221        } dcerpc_co_cancel;
     
    205254        typedef [public] struct {
    206255        } dcerpc_working;
     256
     257        /* RTS data structures */
     258        typedef [public] struct {
     259                GUID            Cookie;
     260        } RTSCookie;
     261
     262        typedef [v1_enum,public] enum {
     263                RTS_IPV4        = 0,
     264                RTS_IPV6        = 1
     265        } AddressType;
     266
     267        typedef [nodiscriminant] union {
     268                [case(RTS_IPV4)] ipv4address    ClientAddressIPV4;
     269                [case(RTS_IPV6)] ipv6address    ClientAddressIPV6;
     270        } ClientAddressType;
     271
     272        typedef [public] struct {
     273                AddressType                                     AddressType;
     274                [switch_is(AddressType)] ClientAddressType      ClientAddress;
     275                uint8                                           Padding[12];
     276        } ClientAddress;
     277
     278        typedef [v1_enum, public] enum {
     279                FDClient        = 0,
     280                FDInProxy       = 1,
     281                FDServer        = 2,
     282                FDOutProxy      = 3
     283        } ForwardDestination;
     284
     285        typedef [public] struct {
     286                uint32          BytesReceived;
     287                uint32          AvailableWindow;
     288                RTSCookie       ChannelCookie;
     289        } FlowControlAcknowledgment;
     290
     291        /* RTS commands */
     292
     293        /* RTS command: 0x0 */
     294        typedef [public] struct {
     295                [range(0x2000,0x40000)] uint32  ReceiveWindowSize;
     296        } dcerpc_rts_cmd_ReceiveWindowSize;
     297
     298        /* RTS command: 0x1 */
     299        typedef [public] struct {
     300                FlowControlAcknowledgment       Ack;
     301        } dcerpc_rts_cmd_FlowControlAck;
     302
     303        /* RTS command: 0x2 */
     304        typedef [public] struct {
     305                [range(0x1D4C0,0xDBBA00)] uint32        ConnectionTimeout;
     306        } dcerpc_rts_cmd_ConnectionTimeout;
     307
     308        /* RTS command: 0x3 */
     309        typedef [public] struct {
     310                RTSCookie       Cookie;
     311        } dcerpc_rts_cmd_Cookie;
     312
     313        /* RTS command: 0x4 */
     314        typedef [public] struct {
     315                [range(0x20000,0x80000000)] uint32      ChannelLifetime;
     316        } dcerpc_rts_cmd_ChannelLifetime;
     317
     318        /* RTS command: 0x5 */
     319        typedef [public] struct {
     320                uint32          ClientKeepalive;
     321        } dcerpc_rts_cmd_ClientKeepalive;
     322
     323        /* RTS command: 0x6 */
     324        typedef [public] struct {
     325                uint32          Version;
     326        } dcerpc_rts_cmd_Version;
     327
     328        /* RTS command: 0x7 */
     329        typedef [public] struct {
     330        } dcerpc_rts_cmd_Empty;
     331
     332        /* RTS command: 0x8 */
     333        typedef [public] struct {
     334                [range(0x0,0xFFFF)] uint32      ConformanceCount;
     335                uint8                           Padding[ConformanceCount];
     336        } dcerpc_rts_cmd_Padding;
     337
     338        /* RTS command: 0x9 */
     339        typedef [public] struct {
     340        } dcerpc_rts_cmd_NegativeANCE;
     341
     342        /* RTS Command: 0xA */
     343        typedef [public] struct {
     344        } dcerpc_rts_cmd_ANCE;
     345
     346        /* RTS command: 0xB */
     347        typedef [public] struct {
     348                ClientAddress   ClientAddress;
     349        } dcerpc_rts_cmd_ClientAddress;
     350
     351        /* RTS command: 0xC */
     352        typedef [public] struct {
     353                RTSCookie       AssociationGroupId;
     354        } dcerpc_rts_cmd_AssociationGroupId;
     355
     356        /* RTS command: 0xD */
     357        typedef [public] struct {
     358                ForwardDestination      ForwardDestination;
     359        } dcerpc_rts_cmd_Destination;
     360
     361        /* RTS command: 0xE */
     362        typedef [public] struct {
     363                uint32  PingTrafficSent;
     364        } dcerpc_rts_cmd_PingTrafficSentNotify;
     365
     366        typedef [nodiscriminant] union {
     367                [case(0x0)] dcerpc_rts_cmd_ReceiveWindowSize            ReceiveWindowSize;
     368                [case(0x1)] dcerpc_rts_cmd_FlowControlAck               FlowControlAck;
     369                [case(0x2)] dcerpc_rts_cmd_ConnectionTimeout            ConnectionTimeout;
     370                [case(0x3)] dcerpc_rts_cmd_Cookie                       Cookie;
     371                [case(0x4)] dcerpc_rts_cmd_ChannelLifetime              ChannelLifetime;
     372                [case(0x5)] dcerpc_rts_cmd_ClientKeepalive              ClientKeepalive;
     373                [case(0x6)] dcerpc_rts_cmd_Version                      Version;
     374                [case(0x7)] dcerpc_rts_cmd_Empty                        Empty;
     375                [case(0x8)] dcerpc_rts_cmd_Padding                      Padding;
     376                [case(0x9)] dcerpc_rts_cmd_NegativeANCE                 NegativeANCE;
     377                [case(0xA)] dcerpc_rts_cmd_ANCE                         ANCE;
     378                [case(0xB)] dcerpc_rts_cmd_ClientAddress                ClientAddress;
     379                [case(0xC)] dcerpc_rts_cmd_AssociationGroupId           AssociationGroupId;
     380                [case(0xD)] dcerpc_rts_cmd_Destination                  Destination;
     381                [case(0xE)] dcerpc_rts_cmd_PingTrafficSentNotify        PingTrafficSentNotify;
     382        } dcerpc_rts_cmds;
     383
     384        typedef [public] struct {
     385                uint32                                          CommandType;
     386                [switch_is(CommandType)] dcerpc_rts_cmds        Command;
     387        } dcerpc_rts_cmd;
     388
     389        /* The RTS flags */
     390        typedef [public, bitmap16bit] bitmap {
     391                RTS_FLAG_NONE                   =       0x0000,
     392                RTS_FLAG_PING                   =       0x0001,
     393                RTS_FLAG_OTHER_CMD              =       0x0002,
     394                RTS_FLAG_RECYCLE_CHANNEL        =       0x0004,
     395                RTS_FLAG_IN_CHANNEL             =       0x0008,
     396                RTS_FLAG_OUT_CHANNEL            =       0x0010,
     397                RTS_FLAG_EOF                    =       0x0020,
     398                RTS_FLAG_ECHO                   =       0x0040
     399        } dcerpc_rts_flags;
     400
     401        typedef [public] struct {
     402                dcerpc_rts_flags        Flags;
     403                uint16                  NumberOfCommands;
     404                dcerpc_rts_cmd          Commands[NumberOfCommands];
     405        } dcerpc_rts;
    207406
    208407        typedef [enum8bit] enum {
     
    226425                DCERPC_PKT_SHUTDOWN    = 17,    /* Server to client request to shutdown. */
    227426                DCERPC_PKT_CO_CANCEL   = 18,    /* Connection-oriented cancel request. */
    228                 DCERPC_PKT_ORPHANED    = 19     /* Client telling server it's aborting a partially sent request or telling server to stop sending replies. */
     427                DCERPC_PKT_ORPHANED    = 19,    /* Client telling server it's aborting a partially sent request or telling server to stop sending replies. */
     428                DCERPC_PKT_RTS         = 20     /* RTS packets used in ncacn_http */
    229429        } dcerpc_pkt_type;
    230430
     
    250450                [case(DCERPC_PKT_ORPHANED)]   dcerpc_orphaned orphaned;
    251451                [case(DCERPC_PKT_AUTH3)]      dcerpc_auth3    auth3;
     452                [case(DCERPC_PKT_RTS)]        dcerpc_rts      rts;
    252453        } dcerpc_payload;
    253454
  • trunk/server/librpc/idl/drsblobs.idl

    r414 r745  
    11#include "idl_types.h"
    22
    3 import "drsuapi.idl", "misc.idl", "samr.idl", "lsa.idl";
     3import "drsuapi.idl", "misc.idl", "samr.idl", "lsa.idl", "security.idl";
    44
    55[
     
    1111]
    1212interface drsblobs {
    13         typedef bitmap drsuapi_DsReplicaSyncOptions drsuapi_DsReplicaSyncOptions;
    14         typedef bitmap drsuapi_DsReplicaNeighbourFlags drsuapi_DsReplicaNeighbourFlags;
     13        typedef bitmap drsuapi_DrsOptions drsuapi_DrsOptions;
    1514        typedef [v1_enum] enum drsuapi_DsAttributeId drsuapi_DsAttributeId;
    1615        typedef [v1_enum] enum lsa_TrustAuthType lsa_TrustAuthType;
     
    3130        typedef struct {
    3231                uint32 count;
    33                 uint32 reserved;
     32                [value(0)] uint32 reserved;
    3433                replPropertyMetaData1 array[count];
    3534        } replPropertyMetaDataCtr1;
     
    4140        typedef [public] struct {
    4241                uint32 version;
    43                 uint32 reserved;
     42                [value(0)] uint32 reserved;
    4443                [switch_is(version)] replPropertyMetaDataCtr ctr;
    4544        } replPropertyMetaDataBlob;
     
    5655        typedef struct {
    5756                uint32 count;
    58                 uint32 reserved;
     57                [value(0)] uint32 reserved;
    5958                drsuapi_DsReplicaCursor cursors[count];
    6059        } replUpToDateVectorCtr1;
     
    6261        typedef struct {
    6362                uint32 count;
    64                 uint32 reserved;
     63                [value(0)] uint32 reserved;
    6564                drsuapi_DsReplicaCursor2 cursors[count];
    6665        } replUpToDateVectorCtr2;
     
    7372        typedef [public] struct {
    7473                uint32 version;
    75                 uint32 reserved;
     74                [value(0)] uint32 reserved;
    7675                [switch_is(version)] replUpToDateVectorCtr ctr;
    7776        } replUpToDateVectorBlob;
     
    9493        typedef [public,gensize,flag(NDR_PAHEX)] struct {
    9594                /* this includes the 8 bytes of the repsFromToBlob header */
    96                 [value(ndr_size_repsFromTo1(this, ndr->iconv_convenience, ndr->flags)+8)] uint32 blobsize;
     95                [value(ndr_size_repsFromTo1(this, ndr->flags)+8)] uint32 blobsize;
    9796                uint32 consecutive_sync_failures;
    9897                NTTIME_1sec last_success;
     
    10099                WERROR result_last_attempt;
    101100                [relative] repsFromTo1OtherInfo *other_info;
    102                 [value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->iconv_convenience, ndr->flags))] uint32 other_info_length;
    103                 drsuapi_DsReplicaNeighbourFlags replica_flags;
     101                [value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->flags))] uint32 other_info_length;
     102                drsuapi_DrsOptions replica_flags;
    104103                uint8 schedule[84];
    105                 uint32 reserved;
     104                [value(0)] uint32 reserved;
    106105                drsuapi_DsReplicaHighWaterMark highwatermark;
    107106                GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */
     
    111110
    112111        typedef [public,relative_base,gensize] struct {
    113                 [value(ndr_size_repsFromTo2OtherInfo(this,ndr->iconv_convenience, ndr->flags))]
     112                [value(ndr_size_repsFromTo2OtherInfo(this,ndr->flags))]
    114113                        uint32 __ndr_size;
    115114                [relative] nstring *dns_name1;
     
    121120        typedef [public,gensize,flag(NDR_PAHEX)] struct {
    122121                /* this includes the 8 bytes of the repsFromToBlob header */
    123                 [value(ndr_size_repsFromTo2(this, ndr->iconv_convenience, ndr->flags)+8)] uint32 blobsize;
     122                [value(ndr_size_repsFromTo2(this, ndr->flags)+8)] uint32 blobsize;
    124123                uint32 consecutive_sync_failures;
    125124                NTTIME_1sec last_success;
     
    127126                WERROR result_last_attempt;
    128127                [relative] repsFromTo2OtherInfo *other_info;
    129                 [value(ndr_size_repsFromTo2OtherInfo(other_info, ndr->iconv_convenience, ndr->flags))] uint32 other_info_length;
    130                 drsuapi_DsReplicaNeighbourFlags replica_flags;
     128                [value(ndr_size_repsFromTo2OtherInfo(other_info, ndr->flags))] uint32 other_info_length;
     129                drsuapi_DrsOptions replica_flags;
    131130                uint8 schedule[84];
    132                 uint32 reserved;
     131                [value(0)] uint32 reserved;
    133132                drsuapi_DsReplicaHighWaterMark highwatermark;
    134133                GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */
     
    145144        typedef [public] struct {
    146145                uint32 version;
    147                 uint32 reserved;
     146                [value(0)] uint32 reserved;
    148147                [switch_is(version)] repsFromTo ctr;
    149148        } repsFromToBlob;
     
    169168        typedef [public] struct {
    170169                uint32 version;
    171                 uint32 reserved;
     170                [value(0)] uint32 reserved;
    172171                [switch_is(version)] partialAttributeSetCtr ctr;
    173172        } partialAttributeSetBlob;
     
    176175                [in] partialAttributeSetBlob blob
    177176                );
     177
     178
     179        /*
     180         * schemaInfo attribute
     181         *
     182         * Used as an attribute on Schema.
     183         * Also during replication as part of
     184         * prefixMap to identify what revision
     185         * of Schema source DC has
     186         */
     187        typedef [public,flag(NDR_NOALIGN)] struct {
     188                [value(0xFF)] uint8 marker;
     189                [flag(NDR_BIG_ENDIAN)] uint32 revision;
     190                GUID   invocation_id;
     191        } schemaInfoBlob;
     192
     193
     194        /*
     195         * MS w2k3 and w2k8 prefixMap format
     196         * There is no version number. Format is:
     197         *   uint32 - number of entries in the map
     198         *   uint32 - total bytes that structure occupies
     199         *   ENTRIES:
     200         *     uint16 - prefix ID (OID's last sub-id encoded. see prefixMap)
     201         *     uint16 - number of bytes in prefix N
     202         *     uint8[N] - BER encoded prefix
     203         */
     204        typedef [noprint,flag(NDR_NOALIGN)] struct {
     205                uint16 entryID;
     206                uint16 length;
     207                uint8 binary_oid[length];
     208        } drsuapi_MSPrefixMap_Entry;
     209
     210        typedef [public,gensize] struct {
     211                uint32 num_entries;
     212                [value(ndr_size_drsuapi_MSPrefixMap_Ctr(r, ndr->flags))] uint32 __ndr_size;
     213                drsuapi_MSPrefixMap_Entry entries[num_entries];
     214        } drsuapi_MSPrefixMap_Ctr;
    178215
    179216        /*
     
    197234        typedef [public] struct {
    198235                prefixMapVersion version;
    199                 uint32 reserved;
     236                [value(0)] uint32 reserved;
    200237                [switch_is(version)] prefixMapCtr ctr;
    201238        } prefixMapBlob;
     
    219256                uint32 u2;
    220257                uint32 u3;
    221                 [value(ndr_size_ldapControlDirSyncExtra(&extra, extra.uptodateness_vector.version, ndr->iconv_convenience, 0))]
     258                [value(ndr_size_ldapControlDirSyncExtra(&extra, extra.uptodateness_vector.version, 0))]
    222259                        uint32 extra_length;
    223260                drsuapi_DsReplicaHighWaterMark highwatermark;
     
    280317        typedef [public] struct {
    281318                [value(0)] uint32 unknown1;
    282                 [value(ndr_size_supplementalCredentialsSubBlob(&sub, ndr->iconv_convenience, ndr->flags))] uint32 __ndr_size;
     319                [value(ndr_size_supplementalCredentialsSubBlob(&sub, ndr->flags))] uint32 __ndr_size;
    283320                [value(0)] uint32 unknown2;
    284321                [subcontext(0),subcontext_size(__ndr_size)] supplementalCredentialsSubBlob sub;
     
    432469                NTTIME LastUpdateTime;
    433470                lsa_TrustAuthType AuthType;
    434                
    435471                [switch_is(AuthType)] AuthInfo AuthInfo;
    436472                [flag(NDR_ALIGN4)] DATA_BLOB _pad;
    437473        } AuthenticationInformation;
    438474
    439         typedef [nopull,nopush,noprint] struct {
    440                 /* sizeis here is bogus, but this is here just for the structure */
    441                 [size_is(1)] AuthenticationInformation array[];
     475        /* count is not on the wire */
     476        typedef [public,nopull,nopush,gensize] struct {
     477                uint32 count;
     478                AuthenticationInformation array[count];
    442479        } AuthenticationInformationArray;
    443480
    444         /* This is nopull,nopush because we pass count down to the
    445          * manual parser of AuthenticationInformationArray */
    446         typedef [public,nopull,nopush,noprint,gensize] struct {
     481        /* we cannot use [relative] pointers here because Windows expects the
     482         * previous_offset to match the total size of the struct in case
     483         * the previous array is empty, see MS-LSAD 2.2.7.16 - gd */
     484        typedef [public,gensize,nopush] struct {
    447485                uint32 count;
    448                 [relative] AuthenticationInformationArray *current;
    449                 [relative] AuthenticationInformationArray *previous;
     486                [value((count > 0) ? 12 : 0)] uint32 current_offset;
     487                [value((count > 0) ? 12 + ndr_size_AuthenticationInformationArray(&current, ndr->flags) : 0)] uint32 previous_offset;
     488                [subcontext(0),subcontext_size((previous_offset)-(current_offset))] AuthenticationInformationArray current;
     489                [subcontext(0)] [flag(NDR_REMAINING)] AuthenticationInformationArray previous;
    450490        } trustAuthInOutBlob;
    451491
    452         void decode_trustAuthInOut(
     492        [nopython] void decode_trustAuthInOut(
    453493                [in] trustAuthInOutBlob blob
    454494                );
    455 
    456         typedef [public,gensize] struct {
    457                 uint32 count;
    458                 [relative] AuthenticationInformation *current[count];
    459         } trustCurrentPasswords;
    460495
    461496        typedef [public,nopull] struct {
    462497                uint8 confounder[512];
    463                 [subcontext(0),subcontext_size(outgoing_size)] trustCurrentPasswords outgoing;
    464                 [subcontext(0),subcontext_size(incoming_size)] trustCurrentPasswords incoming;
    465                 [value(ndr_size_trustCurrentPasswords(&outgoing, ndr->iconv_convenience, ndr->flags))] uint32 outgoing_size;
    466                 [value(ndr_size_trustCurrentPasswords(&incoming, ndr->iconv_convenience, ndr->flags))] uint32 incoming_size;
     498                [subcontext(0),subcontext_size(outgoing_size)] trustAuthInOutBlob outgoing;
     499                [subcontext(0),subcontext_size(incoming_size)] trustAuthInOutBlob incoming;
     500                [value(ndr_size_trustAuthInOutBlob(&outgoing, ndr->flags))] uint32 outgoing_size;
     501                [value(ndr_size_trustAuthInOutBlob(&incoming, ndr->flags))] uint32 incoming_size;
    467502        } trustDomainPasswords;
    468503
    469         void decode_trustDomainPasswords(
     504        [nopython] void decode_trustDomainPasswords(
    470505                [in] trustDomainPasswords blob
    471506                );
     
    548583        } ExtendedErrorInfoPtr;
    549584
    550         void decode_ExtendedErrorInfo (
     585        [nopython] void decode_ExtendedErrorInfo (
    551586                [in,subcontext(0xFFFFFC01)] ExtendedErrorInfoPtr ptr
    552587                );
     588
     589        /* MS-ADTS 7.1.6.9.3 msDS-TrustForestTrustInfo Attribute */
     590
     591        typedef struct {
     592                [value(strlen_m(string))] uint32 size;
     593                [charset(UTF8)] uint8 string[size];
     594        } ForestTrustString;
     595
     596        typedef [flag(NDR_NOALIGN)] struct {
     597                [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
     598                [subcontext(0),subcontext_size(sid_size)] dom_sid sid;
     599                ForestTrustString dns_name;
     600                ForestTrustString netbios_name;
     601        } ForestTrustDataDomainInfo;
     602
     603        typedef [flag(NDR_NOALIGN)] struct {
     604                uint32 size;
     605                uint8 data[size];
     606        } ForestTrustDataBinaryData;
     607
     608        typedef [nodiscriminant] union {
     609                [case(FOREST_TRUST_TOP_LEVEL_NAME)] ForestTrustString name;
     610                [case(FOREST_TRUST_TOP_LEVEL_NAME_EX)] ForestTrustString name;
     611                [case(FOREST_TRUST_DOMAIN_INFO)] ForestTrustDataDomainInfo info;
     612                [default] ForestTrustDataBinaryData data;
     613        } ForestTrustData;
     614
     615        /* same as lsa_ForestTrustRecordType */
     616        typedef [enum8bit] enum {
     617                FOREST_TRUST_TOP_LEVEL_NAME = 0,
     618                FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
     619                FOREST_TRUST_DOMAIN_INFO = 2
     620        } ForestTrustInfoRecordType;
     621
     622        /* meaning of flags depends on record type and values are
     623           the same as in lsa.idl, see collision record types */
     624        typedef [public,gensize,flag(NDR_NOALIGN)] struct {
     625                uint32 flags;
     626                NTTIME timestamp;
     627                ForestTrustInfoRecordType type;
     628                [switch_is(type)] ForestTrustData data;
     629        } ForestTrustInfoRecord;
     630
     631        typedef [flag(NDR_NOALIGN)] struct {
     632                [value(ndr_size_ForestTrustInfoRecord(&record, ndr->flags))] uint32 record_size;
     633                ForestTrustInfoRecord record;
     634        } ForestTrustInfoRecordArmor;
     635
     636        typedef [public,flag(NDR_NOALIGN)] struct {
     637                uint32 version;
     638                uint32 count;
     639                ForestTrustInfoRecordArmor records[count];
     640        } ForestTrustInfo;
     641
     642        [nopython] void decode_ForestTrustInfo(
     643                [in] ForestTrustInfo blob
     644                );
    553645}
  • trunk/server/librpc/idl/drsuapi.idl

    r414 r745  
    11#include "idl_types.h"
    22
    3 import "security.idl", "misc.idl", "samr.idl";
     3import "security.idl", "misc.idl", "lsa.idl", "samr.idl";
    44
    55[
     
    1616        typedef bitmap samr_GroupAttrs samr_GroupAttrs;
    1717
     18        /* see MS-DRSR section 5.39 */
     19        typedef [public,bitmap32bit] bitmap {
     20                DRSUAPI_DRS_ASYNC_OP                  = 0x00000001,
     21                DRSUAPI_DRS_GETCHG_CHECK              = 0x00000002,
     22                DRSUAPI_DRS_UPDATE_NOTIFICATION       = 0x00000002,
     23                DRSUAPI_DRS_ADD_REF                   = 0x00000004,
     24                DRSUAPI_DRS_SYNC_ALL                  = 0x00000008,
     25                DRSUAPI_DRS_DEL_REF                   = 0x00000008,
     26                DRSUAPI_DRS_WRIT_REP                  = 0x00000010,
     27                DRSUAPI_DRS_INIT_SYNC                 = 0x00000020,
     28                DRSUAPI_DRS_PER_SYNC                  = 0x00000040,
     29                DRSUAPI_DRS_MAIL_REP                  = 0x00000080,
     30                DRSUAPI_DRS_ASYNC_REP                 = 0x00000100,
     31                DRSUAPI_DRS_IGNORE_ERROR              = 0x00000100,
     32                DRSUAPI_DRS_TWOWAY_SYNC               = 0x00000200,
     33                DRSUAPI_DRS_CRITICAL_ONLY             = 0x00000400,
     34                DRSUAPI_DRS_GET_ANC                   = 0x00000800,
     35                DRSUAPI_DRS_GET_NC_SIZE               = 0x00001000,
     36                DRSUAPI_DRS_LOCAL_ONLY                = 0x00001000,
     37                DRSUAPI_DRS_NONGC_RO_REP              = 0x00002000,
     38                DRSUAPI_DRS_SYNC_BYNAME               = 0x00004000,
     39                DRSUAPI_DRS_REF_OK                    = 0x00004000,
     40                DRSUAPI_DRS_FULL_SYNC_NOW             = 0x00008000,
     41                DRSUAPI_DRS_NO_SOURCE                 = 0x00008000,
     42                DRSUAPI_DRS_FULL_SYNC_IN_PROGRESS     = 0x00010000,
     43                DRSUAPI_DRS_FULL_SYNC_PACKET          = 0x00020000,
     44                DRSUAPI_DRS_SYNC_REQUEUE              = 0x00040000,
     45                DRSUAPI_DRS_SYNC_URGENT               = 0x00080000,
     46                DRSUAPI_DRS_REF_GCSPN                 = 0x00100000,
     47                DRSUAPI_DRS_NO_DISCARD                = 0x00100000,
     48                DRSUAPI_DRS_NEVER_SYNCED              = 0x00200000,
     49                DRSUAPI_DRS_SPECIAL_SECRET_PROCESSING = 0x00400000,
     50                DRSUAPI_DRS_INIT_SYNC_NOW             = 0x00800000,
     51                DRSUAPI_DRS_PREEMPTED                 = 0x01000000,
     52                DRSUAPI_DRS_SYNC_FORCED               = 0x02000000,
     53                DRSUAPI_DRS_DISABLE_AUTO_SYNC         = 0x04000000,
     54                DRSUAPI_DRS_DISABLE_PERIODIC_SYNC     = 0x08000000,
     55                DRSUAPI_DRS_USE_COMPRESSION           = 0x10000000,
     56                DRSUAPI_DRS_NEVER_NOTIFY              = 0x20000000,
     57                DRSUAPI_DRS_SYNC_PAS                  = 0x40000000,
     58                DRSUAPI_DRS_GET_ALL_GROUP_MEMBERSHIP  = 0x80000000
     59        } drsuapi_DrsOptions;
     60
    1861        /*****************/
    1962        /* Function 0x00 */
     
    2669                DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1                   = 0x00000020,
    2770                DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION    = 0x00000040,
    28                 DRSUAPI_SUPPORTED_EXTENSION_00000080                    = 0x00000080,
     71                DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY                    = 0x00000080,
    2972                DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE                 = 0x00000100,
    3073                DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2                 = 0x00000200,
     
    3982                DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY             = 0x00040000,
    4083                DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3                  = 0x00080000,
    41                 DRSUAPI_SUPPORTED_EXTENSION_00100000                    = 0x00100000,
     84                DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V5                = 0x00100000,
    4285                DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2            = 0x00200000,
    4386                DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6                = 0x00400000,
     
    5497                DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT               = 0x08000000,
    5598                DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS             = 0x10000000,
    56                 DRSUAPI_SUPPORTED_EXTENSION_20000000                    = 0x20000000,
    57                 DRSUAPI_SUPPORTED_EXTENSION_40000000                    = 0x40000000,
    58                 DRSUAPI_SUPPORTED_EXTENSION_80000000                    = 0x80000000
     99                DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10               = 0x20000000,
     100                DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART2              = 0x40000000,
     101                DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART3              = 0x80000000
    59102        } drsuapi_SupportedExtensions;
    60103
    61104        typedef [bitmap32bit] bitmap {
    62105                DRSUAPI_SUPPORTED_EXTENSION_ADAM                        = 0x00000001,
    63                 DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2                    = 0x00000002
     106                DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2                    = 0x00000002,
     107                DRSUAPI_SUPPORTED_EXTENSION_RECYCLE_BIN                 = 0x00000004
    64108        } drsuapi_SupportedExtensionsExt;
    65109
     
    143187        /* Function 0x02 */
    144188        typedef [public,gensize] struct {
    145                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier(r, ndr->iconv_convenience, ndr->flags)-4)] uint32 __ndr_size;
     189                [value(ndr_size_drsuapi_DsReplicaObjectIdentifier(r, ndr->flags)-4)] uint32 __ndr_size;
    146190                [value(ndr_size_dom_sid28(&sid, ndr->flags))]  uint32 __ndr_size_sid;
    147191                GUID guid;
     
    151195        } drsuapi_DsReplicaObjectIdentifier;
    152196
    153         typedef [public] bitmap {
    154                 DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION  = 0x00000001,
    155                 DRSUAPI_DS_REPLICA_SYNC_WRITEABLE               = 0x00000002,
    156                 DRSUAPI_DS_REPLICA_SYNC_PERIODIC                = 0x00000004,
    157                 DRSUAPI_DS_REPLICA_SYNC_INTERSITE_MESSAGING     = 0x00000008,
    158                 DRSUAPI_DS_REPLICA_SYNC_ALL_SOURCES             = 0x00000010,
    159                 DRSUAPI_DS_REPLICA_SYNC_FULL                    = 0x00000020,
    160                 DRSUAPI_DS_REPLICA_SYNC_URGENT                  = 0x00000040,
    161                 DRSUAPI_DS_REPLICA_SYNC_NO_DISCARD              = 0x00000080,
    162                 DRSUAPI_DS_REPLICA_SYNC_FORCE                   = 0x00000100,
    163                 DRSUAPI_DS_REPLICA_SYNC_ADD_REFERENCE           = 0x00000200,
    164                 DRSUAPI_DS_REPLICA_SYNC_NEVER_COMPLETED         = 0x00000400,
    165                 DRSUAPI_DS_REPLICA_SYNC_TWO_WAY                 = 0x00000800,
    166                 DRSUAPI_DS_REPLICA_SYNC_NEVER_NOTIFY            = 0x00001000,
    167                 DRSUAPI_DS_REPLICA_SYNC_INITIAL                 = 0x00002000,
    168                 DRSUAPI_DS_REPLICA_SYNC_USE_COMPRESSION         = 0x00004000,
    169                 DRSUAPI_DS_REPLICA_SYNC_ABANDONED               = 0x00008000,
    170                 DRSUAPI_DS_REPLICA_SYNC_INITIAL_IN_PROGRESS     = 0x00010000,
    171                 DRSUAPI_DS_REPLICA_SYNC_PARTIAL_ATTRIBUTE_SET   = 0x00020000,
    172                 DRSUAPI_DS_REPLICA_SYNC_REQUEUE                 = 0x00040000,
    173                 DRSUAPI_DS_REPLICA_SYNC_NOTIFICATION            = 0x00080000,
    174                 DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_REPLICA    = 0x00100000,
    175                 DRSUAPI_DS_REPLICA_SYNC_CRITICAL                = 0x00200000,
    176                 DRSUAPI_DS_REPLICA_SYNC_FULL_IN_PROGRESS        = 0x00400000,
    177                 DRSUAPI_DS_REPLICA_SYNC_PREEMPTED               = 0x00800000
    178         } drsuapi_DsReplicaSyncOptions;
    179 
    180         typedef struct {
    181                 drsuapi_DsReplicaObjectIdentifier *naming_context;
     197        typedef struct {
     198                [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
    182199                GUID source_dsa_guid;
    183                 astring *other_info; /* I assume this is related to the repsFromTo1OtherInfo dns_name */
    184                 drsuapi_DsReplicaSyncOptions options;
     200                astring *source_dsa_dns; /* Source DSA dns_name in <guid>._msdcs.<domain_dns> form */
     201                drsuapi_DrsOptions options;
    185202        } drsuapi_DsReplicaSyncRequest1;
    186203
    187         typedef [switch_type(int32)] union {
     204        typedef [switch_type(uint32)] union {
    188205                [case(1)] drsuapi_DsReplicaSyncRequest1 req1;
    189206        } drsuapi_DsReplicaSyncRequest;
     
    191208        WERROR drsuapi_DsReplicaSync(
    192209                [in] policy_handle *bind_handle,
    193                 [in] int32 level,
    194                 [in,switch_is(level)] drsuapi_DsReplicaSyncRequest req
     210                [in] uint32 level,
     211                [in,switch_is(level)] drsuapi_DsReplicaSyncRequest *req
    195212                );
    196213
     
    215232                [size_is(count)] drsuapi_DsReplicaCursor cursors[];
    216233        } drsuapi_DsReplicaCursorCtrEx;
    217 
    218         typedef [public] bitmap {
    219                 /* the _WRITEABLE flag indicates a replication with all attributes
    220                  *
    221                  * --metze
    222                  */
    223                 DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE                          = 0x00000010,
    224                 DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP                    = 0x00000020,
    225                 DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS                 = 0x00000040,
    226                 DRSUAPI_DS_REPLICA_NEIGHBOUR_USE_ASYNC_INTERSIDE_TRANSPORT      = 0x00000080,
    227                 DRSUAPI_DS_REPLICA_NEIGHBOUR_ASYNC_REP                          = 0x00000100,
    228                 DRSUAPI_DS_REPLICA_NEIGHBOUR_IGNORE_ERROR                       = 0x00000100,
    229                 DRSUAPI_DS_REPLICA_NEIGHBOUR_TWO_WAY_SYNC                       = 0x00000200,
    230                 DRSUAPI_DS_REPLICA_NEIGHBOUR_CRITICAL_ONLY                      = 0x00000400,
    231                 DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS              = 0x00000800,/*Include updates to ancestor objects before updates to their descendants*/
    232                 DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS                   = 0x00010000,
    233                 DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_SYNC_PACKET                   = 0x00020000,
    234                 DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED                       = 0x00200000,
    235                 DRSUAPI_DS_REPLICA_NEIGHBOUR_SPECIAL_SECRET_PROCESSING          = 0x00800000,
    236                 DRSUAPI_DS_REPLICA_NEIGHBOUR_PREEMPTED                          = 0x01000000,
    237                 DRSUAPI_DS_REPLICA_NEIGHBOUR_IGNORE_CHANGE_NOTIFICATIONS        = 0x04000000,
    238                 DRSUAPI_DS_REPLICA_NEIGHBOUR_DISABLE_SCHEDULED_SYNC             = 0x08000000,
    239                 /*
    240                  * the following NOTE applies to DsGetNCChangesRequest5:
    241                  *  - the data is only compressed when 10 or more objects are replicated
    242                  *  - but there could also be a size limit of 35 KBytes or something like that
    243                  *  - the reply is DsGetNCChangesCtr2
    244                  *  - maybe the same applies to DsGetNCChangesRequest8...
    245                  *
    246                  *  --metze
    247                  */
    248                 DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES                   = 0x10000000,
    249                 DRSUAPI_DS_REPLICA_NEIGHBOUR_NO_CHANGE_NOTIFICATIONS            = 0x20000000,
    250                 DRSUAPI_DS_REPLICA_NEIGHBOUR_PARTIAL_ATTRIBUTE_SET              = 0x40000000
    251         } drsuapi_DsReplicaNeighbourFlags;
    252234
    253235        typedef [flag(NDR_PAHEX),v1_enum] enum {
     
    288270                drsuapi_DsReplicaHighWaterMark highwatermark;
    289271                drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
    290                 drsuapi_DsReplicaNeighbourFlags replica_flags;
     272                drsuapi_DrsOptions replica_flags;
    291273                uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
    292274                uint32 max_ndr_size; /* w2k3 seems to ignore this */
     
    379361         * 2.5.5.17     => dom_sid
    380362         */
    381         typedef [nopush,nopull] struct {
    382                 [range(0,10000),value(ndr_size_drsuapi_DsReplicaOID_oid(oid, 0))] uint32 __ndr_size;
    383                 [size_is(__ndr_size),charset(DOS)] uint8 *oid; /* it's encoded with asn1_write_OID_String() */
     363        typedef [noprint] struct {
     364                [range(0,10000)] uint32 length;
     365                [size_is(length)] uint8 *binary_oid; /* partial-binary-OID encoded with asn1_write_partial_OID_String() */
    384366        } drsuapi_DsReplicaOID;
    385367
     
    401383
    402384        typedef [flag(NDR_PAHEX),v1_enum,public] enum {
    403                 DRSUAPI_ATTRIBUTE_objectClass                   = 0x00000000,
    404                 DRSUAPI_ATTRIBUTE_description                   = 0x0000000d,
    405                 DRSUAPI_ATTRIBUTE_member                        = 0x0000001f,
    406                 DRSUAPI_ATTRIBUTE_instanceType                  = 0x00020001,
    407                 DRSUAPI_ATTRIBUTE_whenCreated                   = 0x00020002,
    408                 DRSUAPI_ATTRIBUTE_possSuperiors                 = 0x00020008,
    409                 DRSUAPI_ATTRIBUTE_hasMasterNCs                  = 0x0002000e,
    410                 DRSUAPI_ATTRIBUTE_subClassOf                    = 0x00020015,
    411                 DRSUAPI_ATTRIBUTE_governsID                     = 0x00020016,
    412                 DRSUAPI_ATTRIBUTE_mustContain                   = 0x00020018,
    413                 DRSUAPI_ATTRIBUTE_mayContain                    = 0x00020019,
    414                 DRSUAPI_ATTRIBUTE_attributeID                   = 0x0002001e,
    415                 DRSUAPI_ATTRIBUTE_attributeSyntax               = 0x00020020,
    416                 DRSUAPI_ATTRIBUTE_isSingleValued                = 0x00020021,
    417                 DRSUAPI_ATTRIBUTE_rangeLower                    = 0x00020022,
    418                 DRSUAPI_ATTRIBUTE_rangeUpper                    = 0x00020023,
    419                 DRSUAPI_ATTRIBUTE_dMDLocation                   = 0x00020024,
    420                 DRSUAPI_ATTRIBUTE_objectVersion                 = 0x0002004c,
    421                 DRSUAPI_ATTRIBUTE_invocationId                  = 0x00020073,
    422                 DRSUAPI_ATTRIBUTE_showInAdvancedViewOnly        = 0x000200a9,
    423                 DRSUAPI_ATTRIBUTE_adminDisplayName              = 0x000200c2,
    424                 DRSUAPI_ATTRIBUTE_adminDescription              = 0x000200e2,
    425                 DRSUAPI_ATTRIBUTE_oMSyntax                      = 0x000200e7,
    426                 DRSUAPI_ATTRIBUTE_ntSecurityDescriptor          = 0x00020119,
    427                 DRSUAPI_ATTRIBUTE_searchFlags                   = 0x0002014e,
    428                 DRSUAPI_ATTRIBUTE_auxiliaryClass                = 0x0002015f,
    429                 DRSUAPI_ATTRIBUTE_lDAPDisplayName               = 0x000201cc,
    430                 DRSUAPI_ATTRIBUTE_name                          = 0x00090001,
    431                 DRSUAPI_ATTRIBUTE_userAccountControl            = 0x00090008,
    432                 DRSUAPI_ATTRIBUTE_currentValue                  = 0x0009001b,
    433                 DRSUAPI_ATTRIBUTE_homeDirectory                 = 0x0009002c,
    434                 DRSUAPI_ATTRIBUTE_homeDrive                     = 0x0009002d,
    435                 DRSUAPI_ATTRIBUTE_scriptPath                    = 0x0009003e,
    436                 DRSUAPI_ATTRIBUTE_profilePath                   = 0x0009008b,
    437                 DRSUAPI_ATTRIBUTE_objectSid                     = 0x00090092,
    438                 DRSUAPI_ATTRIBUTE_schemaIDGUID                  = 0x00090094,
    439                 DRSUAPI_ATTRIBUTE_dBCSPwd                       = 0x00090037,/* lmPwdHash */
    440                 DRSUAPI_ATTRIBUTE_logonHours                    = 0x00090040,
    441                 DRSUAPI_ATTRIBUTE_userWorkstations              = 0x00090056,
    442                 DRSUAPI_ATTRIBUTE_unicodePwd                    = 0x0009005a,/* ntPwdHash */
    443                 DRSUAPI_ATTRIBUTE_ntPwdHistory                  = 0x0009005e,
    444                 DRSUAPI_ATTRIBUTE_priorValue                    = 0x00090064,
    445                 DRSUAPI_ATTRIBUTE_supplementalCredentials       = 0x0009007d,
    446                 DRSUAPI_ATTRIBUTE_trustAuthIncoming             = 0x00090081,
    447                 DRSUAPI_ATTRIBUTE_trustAuthOutgoing             = 0x00090087,
    448                 DRSUAPI_ATTRIBUTE_lmPwdHistory                  = 0x000900a0,
    449                 DRSUAPI_ATTRIBUTE_systemPossSuperiors           = 0x000900c3,
    450                 DRSUAPI_ATTRIBUTE_systemMayContain              = 0x000900c4,
    451                 DRSUAPI_ATTRIBUTE_systemMustContain             = 0x000900c5,
    452                 DRSUAPI_ATTRIBUTE_sAMAccountName                = 0x000900dd,
    453                 DRSUAPI_ATTRIBUTE_sAMAccountType                = 0x0009012e,
    454                 DRSUAPI_ATTRIBUTE_fSMORoleOwner                 = 0x00090171,
    455                 DRSUAPI_ATTRIBUTE_systemFlags                   = 0x00090177,
    456                 DRSUAPI_ATTRIBUTE_serverReference               = 0x00090203,
    457                 DRSUAPI_ATTRIBUTE_serverReferenceBL             = 0x00090204,
    458                 DRSUAPI_ATTRIBUTE_initialAuthIncoming           = 0x0009021b,
    459                 DRSUAPI_ATTRIBUTE_initialAuthOutgoing           = 0x0009021c,
    460                 DRSUAPI_ATTRIBUTE_wellKnownObjects              = 0x0009026a,
    461                 DRSUAPI_ATTRIBUTE_dNSHostName                   = 0x0009026b,
    462                 DRSUAPI_ATTRIBUTE_isMemberOfPartialAttributeSet = 0x0009027f,
    463                 DRSUAPI_ATTRIBUTE_userPrincipalName             = 0x00090290,
    464                 DRSUAPI_ATTRIBUTE_groupType                     = 0x000902ee,
    465                 DRSUAPI_ATTRIBUTE_servicePrincipalName          = 0x00090303,
    466                 DRSUAPI_ATTRIBUTE_objectCategory                = 0x0009030e,
    467                 DRSUAPI_ATTRIBUTE_gPLink                        = 0x0009037b,
    468                 DRSUAPI_ATTRIBUTE_msDS_Behavior_Version         = 0x000905b3,
    469                 DRSUAPI_ATTRIBUTE_msDS_KeyVersionNumber         = 0x000906f6,
    470                 DRSUAPI_ATTRIBUTE_msDS_HasDomainNCs             = 0x0009071c,
    471                 DRSUAPI_ATTRIBUTE_msDS_hasMasterNCs             = 0x0009072c
     385                DRSUAPI_ATTID_objectClass                       = 0x00000000,
     386                DRSUAPI_ATTID_cn                                = 0x00000003,
     387                DRSUAPI_ATTID_ou                                = 0x0000000b,
     388                DRSUAPI_ATTID_description                       = 0x0000000d,
     389                DRSUAPI_ATTID_member                            = 0x0000001f,
     390                DRSUAPI_ATTID_instanceType                      = 0x00020001,
     391                DRSUAPI_ATTID_whenCreated                       = 0x00020002,
     392                DRSUAPI_ATTID_possSuperiors                     = 0x00020008,
     393                DRSUAPI_ATTID_displayName                       = 0x0002000d,
     394                DRSUAPI_ATTID_hasMasterNCs                      = 0x0002000e,
     395                DRSUAPI_ATTID_subClassOf                        = 0x00020015,
     396                DRSUAPI_ATTID_governsID                         = 0x00020016,
     397                DRSUAPI_ATTID_mustContain                       = 0x00020018,
     398                DRSUAPI_ATTID_mayContain                        = 0x00020019,
     399                DRSUAPI_ATTID_rDNAttId                          = 0x0002001A,
     400                DRSUAPI_ATTID_attributeID                       = 0x0002001e,
     401                DRSUAPI_ATTID_attributeSyntax                   = 0x00020020,
     402                DRSUAPI_ATTID_isSingleValued                    = 0x00020021,
     403                DRSUAPI_ATTID_rangeLower                        = 0x00020022,
     404                DRSUAPI_ATTID_rangeUpper                        = 0x00020023,
     405                DRSUAPI_ATTID_dMDLocation                       = 0x00020024,
     406                DRSUAPI_ATTID_isDeleted                         = 0x00020030,
     407                DRSUAPI_ATTID_objectVersion                     = 0x0002004c,
     408                DRSUAPI_ATTID_invocationId                      = 0x00020073,
     409                DRSUAPI_ATTID_showInAdvancedViewOnly            = 0x000200a9,
     410                DRSUAPI_ATTID_adminDisplayName                  = 0x000200c2,
     411                DRSUAPI_ATTID_adminDescription                  = 0x000200e2,
     412                DRSUAPI_ATTID_oMSyntax                          = 0x000200e7,
     413                DRSUAPI_ATTID_ntSecurityDescriptor              = 0x00020119,
     414                DRSUAPI_ATTID_searchFlags                       = 0x0002014e,
     415                DRSUAPI_ATTID_auxiliaryClass                    = 0x0002015f,
     416                DRSUAPI_ATTID_lDAPDisplayName                   = 0x000201cc,
     417                DRSUAPI_ATTID_name                              = 0x00090001,
     418                DRSUAPI_ATTID_userAccountControl                = 0x00090008,
     419                DRSUAPI_ATTID_badPwdCount                       = 0x0009000c,
     420                DRSUAPI_ATTID_codePage                          = 0x00090010,
     421                DRSUAPI_ATTID_countryCode                       = 0x00090019,
     422                DRSUAPI_ATTID_currentValue                      = 0x0009001b,
     423                DRSUAPI_ATTID_homeDirectory                     = 0x0009002c,
     424                DRSUAPI_ATTID_homeDrive                         = 0x0009002d,
     425                DRSUAPI_ATTID_lastLogoff                        = 0x00090033,
     426                DRSUAPI_ATTID_lastLogon                         = 0x00090034,
     427                DRSUAPI_ATTID_dBCSPwd                           = 0x00090037,/* lmPwdHash */
     428                DRSUAPI_ATTID_scriptPath                        = 0x0009003e,
     429                DRSUAPI_ATTID_logonHours                        = 0x00090040,
     430                DRSUAPI_ATTID_userWorkstations                  = 0x00090056,
     431                DRSUAPI_ATTID_unicodePwd                        = 0x0009005a,/* ntPwdHash */
     432                DRSUAPI_ATTID_ntPwdHistory                      = 0x0009005e,
     433                DRSUAPI_ATTID_pwdLastSet                        = 0x00090060,
     434                DRSUAPI_ATTID_primaryGroupID                    = 0x00090062,
     435                DRSUAPI_ATTID_priorValue                        = 0x00090064,
     436                DRSUAPI_ATTID_supplementalCredentials           = 0x0009007d,
     437                DRSUAPI_ATTID_trustAuthIncoming                 = 0x00090081,
     438                DRSUAPI_ATTID_trustAuthOutgoing                 = 0x00090087,
     439                DRSUAPI_ATTID_userParameters                    = 0x0009008a,
     440                DRSUAPI_ATTID_profilePath                       = 0x0009008b,
     441                DRSUAPI_ATTID_objectSid                         = 0x00090092,
     442                DRSUAPI_ATTID_schemaIDGUID                      = 0x00090094,
     443                DRSUAPI_ATTID_comment                           = 0x0009009C,/* User-Comment */
     444                DRSUAPI_ATTID_accountExpires                    = 0x0009009f,
     445                DRSUAPI_ATTID_lmPwdHistory                      = 0x000900a0,
     446                DRSUAPI_ATTID_logonCount                        = 0x000900a9,
     447                DRSUAPI_ATTID_systemPossSuperiors               = 0x000900c3,
     448                DRSUAPI_ATTID_systemMayContain                  = 0x000900c4,
     449                DRSUAPI_ATTID_systemMustContain                 = 0x000900c5,
     450                DRSUAPI_ATTID_systemAuxiliaryClass              = 0x000900c6,
     451                DRSUAPI_ATTID_sAMAccountName                    = 0x000900dd,
     452                DRSUAPI_ATTID_sAMAccountType                    = 0x0009012e,
     453                DRSUAPI_ATTID_options                           = 0x00090133,
     454                DRSUAPI_ATTID_fSMORoleOwner                     = 0x00090171,
     455                DRSUAPI_ATTID_systemFlags                       = 0x00090177,
     456                DRSUAPI_ATTID_serverReference                   = 0x00090203,
     457                DRSUAPI_ATTID_serverReferenceBL                 = 0x00090204,
     458                DRSUAPI_ATTID_initialAuthIncoming               = 0x0009021b,
     459                DRSUAPI_ATTID_initialAuthOutgoing               = 0x0009021c,
     460                DRSUAPI_ATTID_wellKnownObjects                  = 0x0009026a,
     461                DRSUAPI_ATTID_dNSHostName                       = 0x0009026b,
     462                DRSUAPI_ATTID_isMemberOfPartialAttributeSet     = 0x0009027f,
     463                DRSUAPI_ATTID_userPrincipalName                 = 0x00090290,
     464                DRSUAPI_ATTID_groupType                         = 0x000902ee,
     465                DRSUAPI_ATTID_servicePrincipalName              = 0x00090303,
     466                DRSUAPI_ATTID_lastKnownParent                   = 0x0009030d,
     467                DRSUAPI_ATTID_objectCategory                    = 0x0009030e,
     468                DRSUAPI_ATTID_gPLink                            = 0x0009037b,
     469                DRSUAPI_ATTID_transportAddressAttribute         = 0x0009037f,
     470                DRSUAPI_ATTID_msDS_Behavior_Version             = 0x000905b3,
     471                DRSUAPI_ATTID_msDS_KeyVersionNumber             = 0x000906f6,
     472                DRSUAPI_ATTID_msDS_HasDomainNCs                 = 0x0009071c,
     473                DRSUAPI_ATTID_msDS_hasMasterNCs                 = 0x0009072c,
     474                DRSUAPI_ATTID_isRecycled                        = 0x0009080a,
     475
     476                DRSUAPI_ATTID_INVALID                           = 0xFFFFFFFF
    472477        } drsuapi_DsAttributeId;
    473478
     
    485490                drsuapi_DsReplicaHighWaterMark highwatermark;
    486491                drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
    487                 drsuapi_DsReplicaNeighbourFlags replica_flags;
     492                drsuapi_DrsOptions replica_flags;
    488493                uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
    489494                uint32 max_ndr_size; /* w2k3 seems to ignore this */
     
    501506                drsuapi_DsReplicaHighWaterMark highwatermark;
    502507                drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
    503                 drsuapi_DsReplicaNeighbourFlags replica_flags;
     508                drsuapi_DrsOptions replica_flags;
    504509                uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
    505510                uint32 max_ndr_size; /* w2k3 seems to ignore this */
     
    512517        } drsuapi_DsGetNCChangesRequest10;
    513518
    514         typedef [switch_type(int32)] union {
     519        typedef [switch_type(uint32)] union {
    515520                [case(5)] drsuapi_DsGetNCChangesRequest5 req5;
    516521                [case(8)] drsuapi_DsGetNCChangesRequest8 req8;
     
    545550        /* DN String values */
    546551        typedef [public,gensize] struct {
    547                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->iconv_convenience, ndr->flags))] uint32 __ndr_size;
     552                [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags))] uint32 __ndr_size;
    548553                [value(ndr_size_dom_sid28(&sid,ndr->flags))]  uint32 __ndr_size_sid;
    549554                GUID guid;
     
    554559
    555560        typedef [public] struct {
    556                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(r, ndr->iconv_convenience, ndr->flags))] uint32 __ndr_size;
     561                [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(r, ndr->flags))] uint32 __ndr_size;
    557562                [value(ndr_size_dom_sid28(&sid,ndr->flags))]  uint32 __ndr_size_sid;
    558563                GUID guid;
     
    564569        } drsuapi_DsReplicaObjectIdentifier3Binary;
    565570
    566         typedef [public] struct {
     571        typedef [public,noprint] struct {
    567572                drsuapi_DsAttributeId attid;
    568573                drsuapi_DsAttributeValueCtr value_ctr;
     
    617622                uint32 object_count;
    618623                /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
    619                 [value(ndr_size_drsuapi_DsGetNCChangesCtr1(r,ndr->iconv_convenience,ndr->flags)+55)] uint32 __ndr_size;
     624                [value(ndr_size_drsuapi_DsGetNCChangesCtr1(r,ndr->flags)+55)] uint32 __ndr_size;
    620625                drsuapi_DsReplicaObjectListItemEx *first_object;
    621626                boolean32 more_data;
     
    651656                uint32 object_count;
    652657                /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
    653                 [value(ndr_size_drsuapi_DsGetNCChangesCtr6(r,ndr->iconv_convenience,ndr->flags)+55)] uint32 __ndr_size;
     658                [value(ndr_size_drsuapi_DsGetNCChangesCtr6(r,ndr->flags)+55)] uint32 __ndr_size;
    654659                drsuapi_DsReplicaObjectListItemEx *first_object;
    655660                boolean32 more_data;
     
    718723
    719724        typedef struct {
    720                 [range(0,6)] int32 level;
     725                [range(0,6)] uint32 level;
    721726                [range(2,3)] drsuapi_DsGetNCChangesCompressionType type;
    722727                [switch_is(level | (type<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr;
    723728        } drsuapi_DsGetNCChangesCtr7;
    724729
    725         typedef [switch_type(int32)] union {
     730        typedef [switch_type(uint32)] union {
    726731                [case(1)] drsuapi_DsGetNCChangesCtr1 ctr1;
    727732                [case(2)] drsuapi_DsGetNCChangesCtr2 ctr2;
     
    732737        WERROR drsuapi_DsGetNCChanges(
    733738                [in] policy_handle *bind_handle,
    734                 [in] int32 level,
     739                [in] uint32 level,
    735740                [in,ref,switch_is(level)] drsuapi_DsGetNCChangesRequest *req,
    736                 [out,ref] int32 *level_out,
     741                [out,ref] uint32 *level_out,
    737742                [out,ref,switch_is(*level_out)] drsuapi_DsGetNCChangesCtr *ctr
    738743                );
     
    741746        /* Function 0x04 */
    742747        /* [MS-DRSR] 4.1.26 */
    743         typedef bitmap {
    744                 DRSUAPI_DS_REPLICA_UPDATE_ASYNCHRONOUS_OPERATION        = 0x00000001,
    745                 DRSUAPI_DS_REPLICA_UPDATE_GETCHG_CHECK                  = 0x00000002,
    746                 DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE                 = 0x00000004,
    747                 DRSUAPI_DS_REPLICA_UPDATE_DELETE_REFERENCE              = 0x00000008,
    748                 DRSUAPI_DS_REPLICA_UPDATE_WRITEABLE                     = 0x00000010
    749         } drsuapi_DsReplicaUpdateRefsOptions;
    750748
    751749        typedef struct {
     
    753751                [ref,charset(DOS),string] uint8 *dest_dsa_dns_name;
    754752                GUID dest_dsa_guid;
    755                 drsuapi_DsReplicaUpdateRefsOptions options;
     753                drsuapi_DrsOptions options;
    756754        } drsuapi_DsReplicaUpdateRefsRequest1;
    757755
    758         typedef [switch_type(int32)] union {
     756        typedef [switch_type(uint32)] union {
    759757                [case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1;
    760758        } drsuapi_DsReplicaUpdateRefsRequest;
     
    762760        WERROR drsuapi_DsReplicaUpdateRefs(
    763761                [in] policy_handle *bind_handle,
    764                 [in] int32 level,
     762                [in] uint32 level,
    765763                [in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req
    766764                );
     
    768766        /*****************/
    769767        /* Function 0x05 */
    770         typedef bitmap {
    771                 DRSUAPI_DS_REPLICA_ADD_ASYNCHRONOUS_OPERATION   = 0x00000001,
    772                 DRSUAPI_DS_REPLICA_ADD_WRITEABLE                = 0x00000002
    773                 /* TODO ... */
    774         } drsuapi_DsReplicaAddOptions;
    775 
    776768
    777769        typedef struct {
     
    779771                [charset(UTF16),string] uint16 *source_dsa_address;
    780772                uint8 schedule[84];
    781                 drsuapi_DsReplicaAddOptions options;
     773                drsuapi_DrsOptions options;
    782774        } drsuapi_DsReplicaAddRequest1;
    783775
     
    788780                [charset(UTF16),string] uint16 *source_dsa_address;
    789781                uint8 schedule[84];
    790                 drsuapi_DsReplicaAddOptions options;
     782                drsuapi_DrsOptions options;
    791783        } drsuapi_DsReplicaAddRequest2;
    792784
    793         typedef [switch_type(int32)] union {
     785        typedef [switch_type(uint32)] union {
    794786                [case(1)] drsuapi_DsReplicaAddRequest1 req1;
    795787                [case(2)] drsuapi_DsReplicaAddRequest2 req2;
     
    798790        WERROR drsuapi_DsReplicaAdd(
    799791                [in] policy_handle *bind_handle,
    800                 [in] int32 level,
     792                [in] uint32 level,
    801793                [in,switch_is(level)] drsuapi_DsReplicaAddRequest req
    802794                );
     
    805797        /*****************/
    806798        /* Function 0x06 */
    807         typedef bitmap {
    808                 DRSUAPI_DS_REPLICA_ADD_ASYNCHRONOUS_OPERATION   = 0x00000001,
    809                 DRSUAPI_DS_REPLICA_ADD_WRITEABLE                = 0x00000002
    810                 /* TODO ... */
    811         } drsuapi_DsReplicaDeleteOptions;
    812 
    813 
    814799        typedef struct {
    815800                [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
    816801                [charset(UTF16),string] uint16 *source_dsa_address;
    817                 drsuapi_DsReplicaDeleteOptions options;
     802                drsuapi_DrsOptions options;
    818803        } drsuapi_DsReplicaDelRequest1;
    819804
    820         typedef [switch_type(int32)] union {
     805        typedef [switch_type(uint32)] union {
    821806                [case(1)] drsuapi_DsReplicaDelRequest1 req1;
    822807        } drsuapi_DsReplicaDelRequest;
     
    824809        WERROR drsuapi_DsReplicaDel(
    825810                [in] policy_handle *bind_handle,
    826                 [in] int32 level,
     811                [in] uint32 level,
    827812                [in,switch_is(level)] drsuapi_DsReplicaDelRequest req
    828813                );
     
    830815        /*****************/
    831816        /* Function 0x07 */
    832         typedef bitmap {
    833                 DRSUAPI_DS_REPLICA_ADD_ASYNCHRONOUS_OPERATION   = 0x00000001,
    834                 DRSUAPI_DS_REPLICA_ADD_WRITEABLE                = 0x00000002
    835                 /* TODO ... */
    836         } drsuapi_DsReplicaModifyOptions;
    837 
    838817
    839818        typedef struct {
     
    842821                [charset(UTF16),string] uint16 *source_dra_address;
    843822                uint8 schedule[84];
    844                 uint32 replica_flags;
     823                drsuapi_DrsOptions replica_flags;
    845824                uint32 modify_fields;
    846                 drsuapi_DsReplicaModifyOptions options;
     825                drsuapi_DrsOptions options;
    847826        } drsuapi_DsReplicaModRequest1;
    848827
    849         typedef [switch_type(int32)] union {
     828        typedef [switch_type(uint32)] union {
    850829                [case(1)] drsuapi_DsReplicaModRequest1 req1;
    851830        } drsuapi_DsReplicaModRequest;
     
    853832        WERROR drsuapi_DsReplicaMod(
    854833                [in] policy_handle *bind_handle,
    855                 [in] int32 level,
     834                [in] uint32 level,
    856835                [in,switch_is(level)] drsuapi_DsReplicaModRequest req
    857836                );
     
    884863        } drsuapi_DsGetMembershipsCtr1;
    885864
    886         typedef [switch_type(int32)] union {
     865        typedef [switch_type(uint32)] union {
    887866                [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1;
    888867        } drsuapi_DsGetMembershipsCtr;
     
    894873                [size_is(count)] drsuapi_DsReplicaObjectIdentifier **info_array;
    895874                uint32 flags;
    896                 drsuapi_DsMembershipType type;
     875                [range(1,7)] drsuapi_DsMembershipType type;
    897876                drsuapi_DsReplicaObjectIdentifier *domain;
    898877        } drsuapi_DsGetMembershipsRequest1;
    899878
    900         typedef [switch_type(int32)] union {
     879        typedef [switch_type(uint32)] union {
    901880                [case(1)] drsuapi_DsGetMembershipsRequest1 req1;
    902881        } drsuapi_DsGetMembershipsRequest;
    903882
    904         [todo] WERROR drsuapi_DsGetMemberships(
     883        WERROR drsuapi_DsGetMemberships(
    905884                [in] policy_handle *bind_handle,
    906                 [in] int32 level,
     885                [in] uint32 level,
    907886                [in,ref] [switch_is(level)] drsuapi_DsGetMembershipsRequest *req,
    908                 [out,ref] int32 *level_out,
     887                [out,ref] uint32 *level_out,
    909888                [out,ref] [switch_is(*level_out)] drsuapi_DsGetMembershipsCtr *ctr
    910889                );
     
    916895        /*****************/
    917896        /* Function 0x0b */
    918         typedef struct {
    919                 uint32 unknown1;
    920                 uint32 unknown2;
    921                 [range(0,0x00A00000)] uint32 length;
    922                 [size_is(length)] uint8 *data;
     897        typedef [bitmap32bit] bitmap {
     898                DRSUAPI_NT4_CHANGELOG_GET_CHANGELOG             = 0x00000001,
     899                DRSUAPI_NT4_CHANGELOG_GET_SERIAL_NUMBERS        = 0x00000002
     900        } drsuapi_DsGetNT4ChangeLogFlags;
     901
     902        typedef struct {
     903                drsuapi_DsGetNT4ChangeLogFlags flags;
     904                uint32 preferred_maximum_length;
     905                [range(0,0x00A00000)] uint32 restart_length;
     906                [size_is(restart_length)] uint8 *restart_data;
    923907        } drsuapi_DsGetNT4ChangeLogRequest1;
    924908
     
    928912
    929913        typedef struct {
    930                 [range(0,0x00A00000)] uint32 length1;
    931                 [range(0,0x00A00000)] uint32 length2;
    932                 hyper unknown1;
    933                 NTTIME time2;
    934                 hyper unknown3;
    935                 NTTIME time4;
    936                 hyper unknown5;
    937                 NTTIME time6;
     914                [range(0,0x00A00000)] uint32 restart_length;
     915                [range(0,0x00A00000)] uint32 log_length;
     916                hyper sam_serial_number;
     917                NTTIME sam_creation_time;
     918                hyper builtin_serial_number;
     919                NTTIME builtin_creation_time;
     920                hyper lsa_serial_number;
     921                NTTIME lsa_creation_time;
    938922                NTSTATUS status;
    939                 [size_is(length1)] uint8 *data1;
    940                 [size_is(length2)] uint8 *data2;
     923                [size_is(restart_length)] uint8 *restart_data;
     924                [size_is(log_length)] uint8 *log_data;
    941925        } drsuapi_DsGetNT4ChangeLogInfo1;
    942926
     
    945929        } drsuapi_DsGetNT4ChangeLogInfo;
    946930
    947         [todo] WERROR drsuapi_DsGetNT4ChangeLog(
     931        WERROR drsuapi_DsGetNT4ChangeLog(
    948932                [in] policy_handle *bind_handle,
    949933                [in] uint32 level,
     
    975959
    976960        typedef [v1_enum] enum {
    977                 DRSUAPI_DS_NAME_FORMAT_UNKNOWN                  = 0,
    978                 DRSUAPI_DS_NAME_FORMAT_FQDN_1779                = 1,
    979                 DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT              = 2,
    980                 DRSUAPI_DS_NAME_FORMAT_DISPLAY                  = 3,
    981                 DRSUAPI_DS_NAME_FORMAT_GUID                     = 6,
    982                 DRSUAPI_DS_NAME_FORMAT_CANONICAL                = 7,
    983                 DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL           = 8,
    984                 DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX             = 9,
    985                 DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL        = 10,
    986                 DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY       = 11,
    987                 DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN               = 12
     961                DRSUAPI_DS_NAME_FORMAT_UNKNOWN                  = 0x00000000,
     962                DRSUAPI_DS_NAME_FORMAT_FQDN_1779                = 0x00000001,
     963                DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT              = 0x00000002,
     964                DRSUAPI_DS_NAME_FORMAT_DISPLAY                  = 0x00000003,
     965                DRSUAPI_DS_NAME_FORMAT_GUID                     = 0x00000006,
     966                DRSUAPI_DS_NAME_FORMAT_CANONICAL                = 0x00000007,
     967                DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL           = 0x00000008,
     968                DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX             = 0x00000009,
     969                DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL        = 0x0000000A,
     970                DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY       = 0x0000000B,
     971                DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN               = 0x0000000C,
     972                DRSUAPI_DS_NAME_FORMAT_UPN_AND_ALTSECID         = 0xFFFFFFEF,
     973                DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT_NAME_SANS_DOMAIN_EX = 0xFFFFFFF0,
     974                DRSUAPI_DS_NAME_FORMAT_LIST_GLOBAL_CATALOG_SERVERS = 0xFFFFFFF1,
     975                DRSUAPI_DS_NAME_FORMAT_UPN_FOR_LOGON            = 0xFFFFFFF2,
     976                DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_WITH_DCS_IN_SITE = 0xFFFFFFF3,
     977                DRSUAPI_DS_NAME_FORMAT_STRING_SID_NAME          = 0xFFFFFFF4,
     978                DRSUAPI_DS_NAME_FORMAT_ALT_SECURITY_IDENTITIES_NAME = 0xFFFFFFF5,
     979                DRSUAPI_DS_NAME_FORMAT_LIST_NCS                 = 0xFFFFFFF6,
     980                DRSUAPI_DS_NAME_FORMAT_LIST_DOMAINS             = 0xFFFFFFF7,
     981                DRSUAPI_DS_NAME_FORMAT_MAP_SCHEMA_GUID          = 0xFFFFFFF8,
     982                DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT_NAME_SANS_DOMAIN = 0xFFFFFFF9,
     983                DRSUAPI_DS_NAME_FORMAT_LIST_ROLES               = 0xFFFFFFFA,
     984                DRSUAPI_DS_NAME_FORMAT_LIST_INFO_FOR_SERVER     = 0xFFFFFFFB,
     985                DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_FOR_DOMAIN_IN_SITE = 0xFFFFFFFC,
     986                DRSUAPI_DS_NAME_FORMAT_LIST_DOMAINS_IN_SITE     = 0xFFFFFFFD,
     987                DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_IN_SITE     = 0xFFFFFFFE,
     988                DRSUAPI_DS_NAME_FORMAT_LIST_SITES               = 0xFFFFFFFF
    988989        } drsuapi_DsNameFormat;
    989990
     
    10021003        } drsuapi_DsNameRequest1;
    10031004
    1004         typedef [switch_type(int32)] union {
     1005        typedef [switch_type(uint32)] union {
    10051006                [case(1)] drsuapi_DsNameRequest1 req1;
    10061007        } drsuapi_DsNameRequest;
     
    10171018        } drsuapi_DsNameCtr1;
    10181019
    1019         typedef [switch_type(int32)] union {
     1020        typedef [switch_type(uint32)] union {
    10201021                [case(1)] drsuapi_DsNameCtr1 *ctr1;
    10211022        } drsuapi_DsNameCtr;
     
    10231024        WERROR drsuapi_DsCrackNames(
    10241025                [in] policy_handle *bind_handle,
    1025                 [in] int32 level,
     1026                [in] uint32 level,
    10261027                [in,ref,switch_is(level)] drsuapi_DsNameRequest *req,
    1027                 [out,ref] int32 *level_out,
     1028                [out,ref] uint32 *level_out,
    10281029                [out,ref,switch_is(*level_out)] drsuapi_DsNameCtr *ctr
    10291030                );
     
    10451046        } drsuapi_DsWriteAccountSpnRequest1;
    10461047
    1047         typedef [switch_type(int32)] union {
     1048        typedef [switch_type(uint32)] union {
    10481049                [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1;
    10491050        } drsuapi_DsWriteAccountSpnRequest;
     
    10531054        } drsuapi_DsWriteAccountSpnResult1;
    10541055
    1055         typedef [switch_type(int32)] union {
     1056        typedef [switch_type(uint32)] union {
    10561057                [case(1)] drsuapi_DsWriteAccountSpnResult1 res1;
    10571058        } drsuapi_DsWriteAccountSpnResult;
     
    10591060        WERROR drsuapi_DsWriteAccountSpn(
    10601061                [in] policy_handle *bind_handle,
    1061                 [in] int32 level,
     1062                [in] uint32 level,
    10621063                [in,ref,switch_is(level)] drsuapi_DsWriteAccountSpnRequest *req,
    1063                 [out,ref] int32 *level_out,
     1064                [out,ref] uint32 *level_out,
    10641065                [out,ref,switch_is(*level_out)] drsuapi_DsWriteAccountSpnResult *res
    10651066                );
     
    10731074        } drsuapi_DsRemoveDSServerRequest1;
    10741075
    1075         typedef [switch_type(int32)] union {
     1076        typedef [switch_type(uint32)] union {
    10761077                [case(1)] drsuapi_DsRemoveDSServerRequest1 req1;
    10771078        } drsuapi_DsRemoveDSServerRequest;
     
    10811082        } drsuapi_DsRemoveDSServerResult1;
    10821083
    1083         typedef [switch_type(int32)] union {
     1084        typedef [switch_type(uint32)] union {
    10841085                [case(1)] drsuapi_DsRemoveDSServerResult1 res1;
    10851086        } drsuapi_DsRemoveDSServerResult;
     
    10871088        WERROR drsuapi_DsRemoveDSServer(
    10881089                [in] policy_handle *bind_handle,
    1089                 [in] int32 level,
     1090                [in] uint32 level,
    10901091                [in,ref,switch_is(level)] drsuapi_DsRemoveDSServerRequest *req,
    1091                 [out,ref] int32 *level_out,
     1092                [out,ref] uint32 *level_out,
    10921093                [out,ref,switch_is(*level_out)] drsuapi_DsRemoveDSServerResult *res
    10931094                );
     
    12371238        const char *DRSUAPI_NTDSDSA_KRB5_SERVICE_GUID = "E3514235-4B06-11D1-AB04-00C04FC2DCD2";
    12381239
     1240        /* Error codes to classify an error that occurs
     1241         * during a search for, or the update of,
     1242         * a directory object */
     1243        typedef [v1_enum] enum {
     1244                DRSUAPI_DIRERR_OK         = 0,
     1245                DRSUAPI_DIRERR_ATTRIBUTE  = 1,
     1246                DRSUAPI_DIRERR_NAME       = 2,
     1247                DRSUAPI_DIRERR_REFERRAL   = 3,
     1248                DRSUAPI_DIRERR_SECURITY   = 4,
     1249                DRSUAPI_DIRERR_SERVICE    = 5,
     1250                DRSUAPI_DIRERR_UPDATE     = 6,
     1251                DRSUAPI_DIRERR_SYSTEM     = 7
     1252        } drsuapi_DsAddEntry_DirErr;
     1253
    12391254        /*
    1240          * please note the the current idl
    1241          * for DsAddEntry does only parse
    1242          * what I saw between 2 w2k3 boxes
    1243          * in my dssync experiments I got some other replies
    1244          * so all I want to say is that this is very incomplete yet...
    1245          * --metze
     1255         * Ref: DRS_MSG_ADDENTRYREQ_V2, [MS-DRSR]: 4.1.1.1.3
    12461256         */
    12471257        typedef struct {
     
    12491259        } drsuapi_DsAddEntryRequest2;
    12501260
    1251         typedef [switch_type(int32)] union {
     1261        /* Buffer type is actually more
     1262         * like a semi Flags
     1263         * Ref: DRS_SecBuffer, [MS-DRSR]: 5.41 */
     1264        typedef [v1_enum,noprint] enum {
     1265                DRSUAPI_SECBUFFER_EMPTY          = 0x00000000,
     1266                DRSUAPI_SECBUFFER_DATA           = 0x00000001,
     1267                DRSUAPI_SECBUFFER_TOKEN          = 0x00000002,
     1268                DRSUAPI_SECBUFFER_PKG_PARAMS     = 0x00000003,
     1269                DRSUAPI_SECBUFFER_MISSING        = 0x00000004,
     1270                DRSUAPI_SECBUFFER_EXTRA          = 0x00000005,
     1271                DRSUAPI_SECBUFFER_STREAM_TRAILER = 0x00000006,
     1272                DRSUAPI_SECBUFFER_STREAM_HEADER  = 0x00000007,
     1273                DRSUAPI_SECBUFFER_READONLY       = 0x80000000
     1274        } drsuapi_SecBufferType;
     1275
     1276        typedef struct {
     1277                [range(0,10000)] uint32 buf_size;
     1278                drsuapi_SecBufferType buf_type;
     1279                [size_is(buf_size)] uint8 *buffer;
     1280        } drsuapi_SecBuffer;
     1281
     1282        typedef struct {
     1283                [value(0)] uint32 version;
     1284                [range(0,10000)] uint32 buff_count;
     1285                [size_is(buff_count)] drsuapi_SecBuffer *buffers;
     1286        } drsuapi_SecBufferDesc;
     1287
     1288        /*
     1289         * Ref: DRS_MSG_ADDENTRYREQ_V3, [MS-DRSR]: 4.1.1.1.4
     1290         */
     1291        typedef struct {
     1292                drsuapi_DsReplicaObjectListItem first_object;
     1293                drsuapi_SecBufferDesc *client_creds;
     1294        } drsuapi_DsAddEntryRequest3;
     1295
     1296        typedef [switch_type(uint32)] union {
    12521297                [case(2)] drsuapi_DsAddEntryRequest2 req2;
     1298                [case(3)] drsuapi_DsAddEntryRequest3 req3;
    12531299        } drsuapi_DsAddEntryRequest;
    12541300
    1255         typedef struct {
    1256                 uint32 unknown1;
     1301        /* Generic extended error info
     1302         * commonly used in most places
     1303         * where rich error info is returned */
     1304        typedef struct {
     1305                uint32  dsid;           /* implementation-specific diagnostic code */
     1306                WERROR  extended_err;   /* 0, STATUS code, or Windows error code */
     1307                uint32  extended_data;  /* implementation-specific diagnostic code */
     1308                uint16  problem;        /* 0 or PROBLEM error code */
     1309        } drsuapi_DsAddEntryErrorInfoX;
     1310
     1311        /* Attribute errors
     1312         * Ref: ATRERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.11 */
     1313        typedef struct {
     1314                uint32  dsid;
     1315                WERROR  extended_err;
     1316                uint32  extended_data;
     1317                uint16  problem;
     1318                drsuapi_DsAttributeId attid;
     1319                boolean32 is_val_returned;
     1320                drsuapi_DsAttributeValue attr_val;
     1321        } drsuapi_DsAddEntry_AttrErr_V1;
     1322
     1323        typedef [noprint] struct {
     1324                drsuapi_DsAddEntry_AttrErrListItem_V1 *next;
     1325                drsuapi_DsAddEntry_AttrErr_V1 err_data;
     1326        } drsuapi_DsAddEntry_AttrErrListItem_V1;
     1327
     1328        typedef struct {
     1329                drsuapi_DsReplicaObjectIdentifier *id;
     1330                uint32 count;
     1331                drsuapi_DsAddEntry_AttrErrListItem_V1 first;
     1332        } drsuapi_DsAddEntryErrorInfo_Attr_V1;
     1333
     1334        /* Name resolution error
     1335         * Ref: NAMERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.14 */
     1336        typedef struct {
     1337                uint32  dsid;
     1338                WERROR  extended_err;
     1339                uint32  extended_data;
     1340                uint16  problem;
     1341                drsuapi_DsReplicaObjectIdentifier *id_matched; /* The best match for the supplied object identity */
     1342        } drsuapi_DsAddEntryErrorInfo_Name_V1;
     1343
     1344        /* Referral error
     1345         * Ref: REFERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.15 */
     1346        typedef struct {
     1347                [value(83)] uint8  name_res;    /* Must be 'S' */
     1348                [value(0)]  uint8  unused_pad;
     1349                [value(0)]  uint16 next_rdn;
     1350        } drsuapi_NameResOp_V1;
     1351
     1352        typedef [enum16bit] enum {
     1353                DRSUAPI_CH_REFTYPE_SUPERIOR     = 0x0000, /* referral to a superior DC */
     1354                DRSUAPI_CH_REFTYPE_SUBORDINATE  = 0x0001, /* referral to a subordinate DC */
     1355                DRSUAPI_CH_REFTYPE_NSSR         = 0x0002, /* Not used */
     1356                DRSUAPI_CH_REFTYPE_CROSS        = 0x0003  /* A referral to an external crossRef object */
     1357        } drsuapi_DsAddEntry_RefType;
     1358
     1359        typedef [enum8bit] enum {
     1360                DRSUAPI_SE_CHOICE_BASE_ONLY     = 0x00,
     1361                DRSUAPI_SE_CHOICE_IMMED_CHLDRN  = 0x01,
     1362                DRSUAPI_SE_CHOICE_WHOLE_SUBTREE = 0x02
     1363        } drsuapi_DsAddEntry_ChoiceType;
     1364
     1365        /* list of network names of the DCs
     1366         * to which the referral is directed */
     1367        typedef struct  {
     1368                drsuapi_DsaAddressListItem_V1 *next;
     1369                lsa_String *address;
     1370        } drsuapi_DsaAddressListItem_V1;
     1371
     1372        typedef struct {
     1373                drsuapi_DsReplicaObjectIdentifier *id_target; /* object to which the referral is directed */
     1374                drsuapi_NameResOp_V1 op_state;
     1375                [value(0)] uint16 rdn_alias;
     1376                [value(0)] uint16 rdn_internal;
     1377                drsuapi_DsAddEntry_RefType ref_type;
     1378                uint16 addr_list_count;
     1379                drsuapi_DsaAddressListItem_V1 *addr_list;
     1380                drsuapi_DsAddEntry_RefErrListItem_V1 *next;
     1381                boolean32 is_choice_set;
     1382                drsuapi_DsAddEntry_ChoiceType choice;
     1383        } drsuapi_DsAddEntry_RefErrListItem_V1;
     1384
     1385        typedef struct {
     1386                uint32  dsid;
     1387                WERROR  extended_err;
     1388                uint32  extended_data;
     1389                drsuapi_DsAddEntry_RefErrListItem_V1 refer;
     1390        } drsuapi_DsAddEntryErrorInfo_Referr_V1;
     1391
     1392        typedef [switch_type(uint32)] union {
     1393                [case(1)] drsuapi_DsAddEntryErrorInfo_Attr_V1   attr_err;
     1394                [case(2)] drsuapi_DsAddEntryErrorInfo_Name_V1   name_err;
     1395                [case(3)] drsuapi_DsAddEntryErrorInfo_Referr_V1 referral_err;
     1396                [case(4)] drsuapi_DsAddEntryErrorInfoX          security_err;
     1397                [case(5)] drsuapi_DsAddEntryErrorInfoX          service_err;
     1398                [case(6)] drsuapi_DsAddEntryErrorInfoX          update_err;
     1399                [case(7)] drsuapi_DsAddEntryErrorInfoX          system_err;
     1400        } drsuapi_DsAddEntryErrorInfo;
     1401
     1402        typedef struct {
    12571403                WERROR status;
    1258                 uint32 unknown2;
    1259                 uint16 unknown3;
    1260         } drsuapi_DsAddEntryErrorInfoX;
    1261 
    1262         typedef struct {
    1263                 [range(0,10485760)] uint32 size;
    1264                 [size_is(size)] uint8 *data;
    1265         } drsuapi_DsAddEntryExtraErrorBuffer;
    1266 
    1267         typedef struct {
    1268                 drsuapi_DsAddEntryErrorInfoX error;
    1269                 drsuapi_DsAttributeId attid;
    1270                 uint32 unknown2;
    1271                 drsuapi_DsAddEntryExtraErrorBuffer buffer;
    1272         } drsuapi_DsAddEntryExtraError1;
    1273 
    1274         typedef /*[noprint]*/ struct {
    1275                 drsuapi_DsAddEntryErrorListItem1 *next;
    1276                 drsuapi_DsAddEntryExtraError1 error;
    1277         } drsuapi_DsAddEntryErrorListItem1;
    1278 
    1279         typedef struct {
    1280                 drsuapi_DsReplicaObjectIdentifier *id;
    1281                 WERROR status;
    1282                 drsuapi_DsAddEntryErrorListItem1 first;
    1283         } drsuapi_DsAddEntryErrorInfo1;
    1284 
    1285         typedef [switch_type(uint32)] union {
    1286                 [case(1)] drsuapi_DsAddEntryErrorInfo1 error1;
    1287 /*              [case(2)] drsuapi_DsAddEntryErrorInfo2 error2;
    1288                 [case(3)] drsuapi_DsAddEntryErrorInfo3 error3;
    1289 */              [case(4)] drsuapi_DsAddEntryErrorInfoX errorX;
    1290                 [case(5)] drsuapi_DsAddEntryErrorInfoX errorX;
    1291                 [case(6)] drsuapi_DsAddEntryErrorInfoX errorX;
    1292                 [case(7)] drsuapi_DsAddEntryErrorInfoX errorX;
    1293         } drsuapi_DsAddEntryErrorInfo;
    1294 
    1295         typedef struct {
    1296                 WERROR status;
    1297                 uint32 level;
    1298                 [switch_is(level)] drsuapi_DsAddEntryErrorInfo *info;
    1299         } drsuapi_DsAddEntryError1;
    1300 
    1301         typedef [switch_type(uint32)] union {
    1302                 [case(1)] drsuapi_DsAddEntryError1 info1;
    1303         } drsuapi_DsAddEntryError;
     1404                drsuapi_DsAddEntry_DirErr dir_err;
     1405                [switch_is(dir_err)] drsuapi_DsAddEntryErrorInfo *info;
     1406        } drsuapi_DsAddEntry_ErrData_V1;
     1407
     1408        typedef [switch_type(uint32)] union {
     1409                [case(1)] drsuapi_DsAddEntry_ErrData_V1 v1;
     1410        } drsuapi_DsAddEntry_ErrData;
    13041411
    13051412        typedef struct {
     
    13101417        typedef struct {
    13111418                drsuapi_DsReplicaObjectIdentifier *id;
    1312                 uint32 unknown1;
    1313                 drsuapi_DsAddEntryErrorInfoX error;
     1419                drsuapi_DsAddEntry_DirErr dir_err;
     1420                uint32                    dsid;          /* implementation-specific diagnostic code */
     1421                WERROR                    extended_err;  /* 0, STATUS code, or Windows error code */
     1422                uint32                    extended_data; /* implementation-specific diagnostic code */
     1423                uint16                    problem;       /* 0 or PROBLEM error code */
    13141424                [range(0,10000)] uint32 count;
    13151425                [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
     
    13181428        typedef struct {
    13191429                drsuapi_DsReplicaObjectIdentifier *id;
    1320                 uint32 level;
    1321                 [switch_is(level)] drsuapi_DsAddEntryError *error;
     1430                uint32 err_ver; /* Must be 1 */
     1431                [switch_is(err_ver)] drsuapi_DsAddEntry_ErrData *err_data;
    13221432                [range(0,10000)] uint32 count;
    13231433                [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
    13241434        } drsuapi_DsAddEntryCtr3;
    13251435
    1326         typedef [switch_type(int32)] union {
     1436        typedef [switch_type(uint32)] union {
    13271437                [case(2)] drsuapi_DsAddEntryCtr2 ctr2;
    13281438                [case(3)] drsuapi_DsAddEntryCtr3 ctr3;
     
    13311441        [public] WERROR drsuapi_DsAddEntry(
    13321442                [in] policy_handle *bind_handle,
    1333                 [in] int32 level,
     1443                [in] uint32 level,
    13341444                [in,ref,switch_is(level)] drsuapi_DsAddEntryRequest *req,
    1335                 [out,ref] int32 *level_out,
     1445                [out,ref] uint32 *level_out,
    13361446                [out,ref,switch_is(*level_out)] drsuapi_DsAddEntryCtr *ctr
    13371447                );
     
    13781488                DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2                   = 9,
    13791489                DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2       = 10,
    1380                 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02                     = -2,
    1381                 DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04                   = -4,
    1382                 DRSUAPI_DS_REPLICA_INFO_CURSORS05                       = -5,
    1383                 DRSUAPI_DS_REPLICA_INFO_06                              = -6
     1490                DRSUAPI_DS_REPLICA_INFO_REPSTO                          = -2,
     1491                DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS                 = -4,
     1492                DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1              = -5,
     1493                DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS           = -6
    13841494        } drsuapi_DsReplicaInfoType;
    13851495
     
    13871497                drsuapi_DsReplicaInfoType info_type;
    13881498                [charset(UTF16),string] uint16 *object_dn;
    1389                 GUID guid1;
     1499                GUID source_dsa_guid;
    13901500        } drsuapi_DsReplicaGetInfoRequest1;
    13911501
     
    13931503                drsuapi_DsReplicaInfoType info_type;
    13941504                [charset(UTF16),string] uint16 *object_dn;
    1395                 GUID guid1;
    1396                 uint32 unknown1;
    1397                 [charset(UTF16),string] uint16 *string1;
    1398                 [charset(UTF16),string] uint16 *string2;
    1399                 uint32 unknown2;
     1505                GUID source_dsa_guid;
     1506                uint32 flags;
     1507                [charset(UTF16),string] uint16 *attribute_name;
     1508                [charset(UTF16),string] uint16 *value_dn_str;
     1509                uint32 enumeration_context;
    14001510        } drsuapi_DsReplicaGetInfoRequest2;
    14011511
     
    14101520                [charset(UTF16),string] uint16 *source_dsa_address;
    14111521                [charset(UTF16),string] uint16 *transport_obj_dn;
    1412                 drsuapi_DsReplicaNeighbourFlags replica_flags;
     1522                drsuapi_DrsOptions replica_flags;
    14131523                uint32 reserved;
    14141524                GUID naming_context_obj_guid;
     
    14731583        } drsuapi_DsReplicaOpType;
    14741584
    1475         typedef [switch_type(drsuapi_DsReplicaOpType)] union {
    1476                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_SYNC)]         drsuapi_DsReplicaSyncOptions sync;
    1477                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_ADD)]          drsuapi_DsReplicaAddOptions add;
    1478                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_DELETE)]       drsuapi_DsReplicaDeleteOptions op_delete;
    1479                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY)]       drsuapi_DsReplicaModifyOptions modify;
    1480                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS)]  drsuapi_DsReplicaUpdateRefsOptions update_refs;
    1481                 [default] uint32 unknown;
    1482         } drsuapi_DsRplicaOpOptions;
    1483 
    14841585        typedef struct {
    14851586                NTTIME operation_start;
     
    14871588                uint32 priority;
    14881589                drsuapi_DsReplicaOpType operation_type;
    1489                 [switch_is(operation_type)] drsuapi_DsRplicaOpOptions options;
     1590                drsuapi_DrsOptions options;
    14901591                [charset(UTF16),string] uint16 *nc_dn;
    14911592                [charset(UTF16),string] uint16 *remote_dsa_obj_dn;
     
    15171618        typedef struct {
    15181619                uint32 count;
    1519                 int32 enumeration_context;
     1620                uint32 enumeration_context;
    15201621                [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[];
    15211622        } drsuapi_DsReplicaAttrValMetaDataCtr;
     
    15231624        typedef struct {
    15241625                uint32 count;
    1525                 int32 enumeration_context;
     1626                uint32 enumeration_context;
    15261627                [size_is(count)] drsuapi_DsReplicaCursor2 array[];
    15271628        } drsuapi_DsReplicaCursor2Ctr;
     
    15361637        typedef struct {
    15371638                uint32 count;
    1538                 int32 enumeration_context;
     1639                uint32 enumeration_context;
    15391640                [size_is(count)] drsuapi_DsReplicaCursor3 array[];
    15401641        } drsuapi_DsReplicaCursor3Ctr;
     
    15521653        typedef struct {
    15531654                uint32 count;
    1554                 int32 enumeration_context;
     1655                uint32 enumeration_context;
    15551656                [size_is(count)] drsuapi_DsReplicaObjMetaData2 array[];
    15561657        } drsuapi_DsReplicaObjMetaData2Ctr;
     
    15731674        typedef struct {
    15741675                uint32 count;
    1575                 int32 enumeration_context;
     1676                uint32 enumeration_context;
    15761677                [size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[];
    15771678        } drsuapi_DsReplicaAttrValMetaData2Ctr;
     
    16221723                [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2;
    16231724                [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2;
    1624                 [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02)] drsuapi_DsReplicaNeighbourCtr *neighbours02;
    1625                 [case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] drsuapi_DsReplicaConnection04Ctr *connections04;
    1626                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS05)] drsuapi_DsReplicaCursorCtrEx *cursors05;
    1627                 [case(DRSUAPI_DS_REPLICA_INFO_06)] drsuapi_DsReplica06Ctr *i06;
     1725                [case(DRSUAPI_DS_REPLICA_INFO_REPSTO)] drsuapi_DsReplicaNeighbourCtr *repsto;
     1726                [case(DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS)] drsuapi_DsReplicaConnection04Ctr *clientctx;
     1727                [case(DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1)] drsuapi_DsReplicaCursorCtrEx *udv1;
     1728                [case(DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS)] drsuapi_DsReplica06Ctr *srvoutgoingcalls;
    16281729        } drsuapi_DsReplicaInfo;
    16291730
     
    16481749        } drsuapi_DsGetMemberships2Ctr1;
    16491750
    1650         typedef [switch_type(int32)] union {
     1751        typedef [switch_type(uint32)] union {
    16511752                [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1;
    16521753        } drsuapi_DsGetMemberships2Ctr;
     
    16571758        } drsuapi_DsGetMemberships2Request1;
    16581759
    1659         typedef [switch_type(int32)] union {
     1760        typedef [switch_type(uint32)] union {
    16601761                [case(1)] drsuapi_DsGetMemberships2Request1 req1;
    16611762        } drsuapi_DsGetMemberships2Request;
     
    16631764        WERROR drsuapi_DsGetMemberships2(
    16641765                [in] policy_handle *bind_handle,
    1665                 [in] int32 level,
     1766                [in] uint32 level,
    16661767                [in,ref] [switch_is(level)] drsuapi_DsGetMemberships2Request *req,
    1667                 [out,ref] int32 *level_out,
     1768                [out,ref] uint32 *level_out,
    16681769                [out,ref] [switch_is(*level_out)] drsuapi_DsGetMemberships2Ctr *ctr
    16691770                );
     
    16871788                [range(0,10000)] uint32 num_info;
    16881789                [size_is(num_info)] drsuapi_DsSiteCostInfo *info;
    1689                 uint32 unknown;
     1790                [value(0)] uint32 flags_reserved;
    16901791        } drsuapi_QuerySitesByCostCtr1;
    16911792
    1692         typedef [switch_type(int32)] union {
     1793        typedef [switch_type(uint32)] union {
    16931794                [case(1)] drsuapi_QuerySitesByCostCtr1 ctr1;
    16941795        } drsuapi_QuerySitesByCostCtr;
     
    17011802        } drsuapi_QuerySitesByCostRequest1;
    17021803
    1703         typedef [switch_type(int32)] union {
     1804        typedef [switch_type(uint32)] union {
    17041805                [case(1)] drsuapi_QuerySitesByCostRequest1 req1;
    17051806        } drsuapi_QuerySitesByCostRequest;
     
    17071808        WERROR drsuapi_QuerySitesByCost(
    17081809                [in] policy_handle *bind_handle,
    1709                 [in] int32 level,
     1810                [in] uint32 level,
    17101811                [in,ref] [switch_is(level)] drsuapi_QuerySitesByCostRequest *req,
    1711                 [out,ref] int32 *level_out,
     1812                [out,ref] uint32 *level_out,
    17121813                [out,ref] [switch_is(*level_out)] drsuapi_QuerySitesByCostCtr *ctr
    17131814        );
  • trunk/server/librpc/idl/epmapper.idl

    r414 r745  
    3131        */
    3232
     33        const int EPMAPPER_STATUS_CANT_PERFORM_OP = 0x6d8;
    3334        const int EPMAPPER_STATUS_NO_MORE_ENTRIES = 0x16c9a0d6;
    3435        const int EPMAPPER_STATUS_NO_MEMORY = 0x16C9A012;
    3536        const int EPMAPPER_STATUS_OK = 0;
    36 
    37 
    3837
    3938        typedef [enum8bit] enum {
     
    217216
    218217        typedef struct {
    219                 [value(ndr_size_epm_tower(&tower, ndr->iconv_convenience, ndr->flags))] uint32  tower_length;
     218                [value(ndr_size_epm_tower(&tower, ndr->flags))] uint32  tower_length;
    220219                [subcontext(4)] epm_tower tower;
    221220        } epm_twr_t;
     
    256255                [in, size_is(num_ents)]  epm_entry_t entries[]
    257256                );
    258    
     257
     258        typedef [v1_enum] enum {
     259                RPC_C_EP_ALL_ELTS               = 0x00000000,
     260                RPC_C_EP_MATCH_BY_IF            = 0x00000001,
     261                RPC_C_EP_MATCH_BY_OBJ           = 0x00000002,
     262                RPC_C_EP_MATCH_BY_BOTH          = 0x00000003
     263        } epm_InquiryType;
     264
     265        typedef [v1_enum] enum {
     266                RPC_C_VERS_ALL                  = 0x00000000,
     267                RPC_C_VERS_COMPATIBLE           = 0x00000001,
     268                RPC_C_VERS_EXACT                = 0x00000002,
     269                RPC_C_VERS_MAJOR_ONLY           = 0x00000003,
     270                RPC_C_VERS_UPTO                 = 0x00000004
     271        } epm_VersionOption;
     272
    259273        /**********************/
    260274        /* Function 0x02      */
    261275        error_status_t epm_Lookup(
    262                 [in]            uint32          inquiry_type,
    263                 [in,ptr]       GUID            *object,
    264                 [in,ptr]       rpc_if_id_t     *interface_id,
    265                 [in]            uint32          vers_option,
    266                 [in,out]        policy_handle   *entry_handle,
    267                 [in]            uint32          max_ents,
    268                 [out]           uint32          *num_ents,
     276                [in]            epm_InquiryType    inquiry_type,
     277                [in,ptr]        GUID               *object,
     278                [in,ptr]        rpc_if_id_t        *interface_id,
     279                [in]            epm_VersionOption  vers_option,
     280                [in,out]        policy_handle      *entry_handle,
     281                [in]            uint32             max_ents,
     282                [out]           uint32             *num_ents,
    269283                [out, length_is(*num_ents), size_is(max_ents)]  epm_entry_t entries[]
    270284                );
  • trunk/server/librpc/idl/frsrpc.idl

    r414 r745  
    339339                [value(pkt_len+12)] uint32 memory_len;
    340340                [value(ndr_size_frsrpc_CommPktChunkCtr(r->ctr,
    341                         ndr->iconv_convenience, ndr->flags))]
     341                        ndr->flags))]
    342342                [range(0, 262144)]
    343343                        uint32 pkt_len;
  • trunk/server/librpc/idl/frstrans.idl

    r414 r745  
    278278        /*****************/
    279279        /* Function 0x0f */
    280         [todo] void FRSTRANS_RAW_GET_FILE_DATA_ASYNC();
     280        typedef pipe uint8 frstrans_BytePipe;
     281
     282        WERROR frstrans_RawGetFileDataAsync(
     283                [in,ref] policy_handle *server_context,
     284                [out,ref] frstrans_BytePipe *byte_pipe
     285                );
    281286
    282287        /*****************/
    283288        /* Function 0x10 */
    284         [todo] void FRSTRANS_RDC_GET_FILE_DATA_ASYNC();
     289        WERROR frstrans_RdcGetFileDataAsync(
     290                [in,ref] policy_handle *server_context,
     291                [out,ref] frstrans_BytePipe *byte_pipe
     292                );
    285293}
  • trunk/server/librpc/idl/idl_types.h

    r596 r745  
    1414*/
    1515#define nstring         [flag(STR_NULLTERM|NDR_ALIGN2)] string
    16 
    17 /*
    18   an ascii string prefixed with [offset] [length], both 32 bits
    19   null terminated
    20 */
    21 #define ascstr2         [flag(STR_ASCII|STR_LEN4)] string
    22 
    23 /*
    24   an ascii string prefixed with [size], 32 bits
    25 */
    26 #define asclstr         [flag(STR_ASCII|STR_SIZE4)] string
    27 
    28 /*
    29   an ascii string prefixed with [size], 16 bits
    30   null terminated
    31 */
    32 #define ascstr3         [flag(STR_ASCII|STR_SIZE2)] string
    33 
    34 /*
    35   an ascii string prefixed with [size] [offset] [length], all 32 bits
    36   not null terminated
    37 */
    38 #define ascstr_noterm   [flag(STR_NOTERM|STR_ASCII|STR_SIZE4|STR_LEN4)] string
    3916
    4017/*
  • trunk/server/librpc/idl/krb5pac.idl

    r414 r745  
    123123                );
    124124
     125        void decode_login_info_ctr(
     126                [in] PAC_LOGON_INFO_CTR logon_info_ctr
     127                );
     128
    125129        void decode_pac_validate(
    126130                [in] PAC_Validate pac_validate
  • trunk/server/librpc/idl/lsa.idl

    r414 r745  
    114114        /* Function: 0x06 */
    115115        typedef struct {
    116                 uint32  len; /* ignored */
     116                uint3264  len; /* ignored */
    117117                uint16  impersonation_level;
    118118                uint8   context_mode;
     
    121121
    122122        typedef struct {
    123                 uint32 len; /* ignored */
     123                uint3264 len; /* ignored */
    124124                uint8 *root_dir;
    125125                [string,charset(UTF16)] uint16 *object_name;
     
    520520
    521521        const int LSA_REF_DOMAIN_LIST_MULTIPLIER = 32;
    522         typedef struct {
     522        typedef [public] struct {
    523523                [range(0,1000)] uint32 count;
    524524                [size_is(count)] lsa_DomainInfo *domains;
     
    534534         */
    535535
    536         typedef enum {
     536        typedef [public] enum {
    537537                LSA_LOOKUP_NAMES_ALL = 1,
    538538                LSA_LOOKUP_NAMES_DOMAINS_ONLY = 2,
     
    564564        } lsa_TranslatedName;
    565565
    566         typedef struct {
     566        typedef [public] struct {
    567567                [range(0,20480)] uint32 count;
    568568                [size_is(count)] lsa_TranslatedName *names;
     
    640640        [todo] NTSTATUS lsa_SetQuotasForAccount();
    641641
    642         typedef [bitmap32bit] bitmap {
    643                 LSA_POLICY_MODE_INTERACTIVE             = 0x00000001,
    644                 LSA_POLICY_MODE_NETWORK                 = 0x00000002,
    645                 LSA_POLICY_MODE_BATCH                   = 0x00000004,
    646                 LSA_POLICY_MODE_SERVICE                 = 0x00000010,
    647                 LSA_POLICY_MODE_PROXY                   = 0x00000020,
    648                 LSA_POLICY_MODE_DENY_INTERACTIVE        = 0x00000040,
    649                 LSA_POLICY_MODE_DENY_NETWORK            = 0x00000080,
    650                 LSA_POLICY_MODE_DENY_BATCH              = 0x00000100,
    651                 LSA_POLICY_MODE_DENY_SERVICE            = 0x00000200,
    652                 LSA_POLICY_MODE_REMOTE_INTERACTIVE      = 0x00000400,
    653                 LSA_POLICY_MODE_DENY_REMOTE_INTERACTIVE = 0x00000800,
    654                 LSA_POLICY_MODE_ALL                     = 0x00000FF7,
    655                 LSA_POLICY_MODE_ALL_NT4                 = 0x00000037
    656         } lsa_SystemAccessModeFlags;
    657 
    658642        /* Function:    0x17 */
    659643        NTSTATUS lsa_GetSystemAccessAccount(
     
    677661
    678662        typedef [flag(NDR_PAHEX)] struct {
    679                 uint32 length;
    680                 uint32 size;
     663                uint3264 length;
     664                uint3264 size;
    681665                [size_is(size),length_is(length)] uint8 *data;
    682666        } lsa_DATA_BUF;
     
    771755        } lsa_TrustDomainInfoBuffer;
    772756
    773         typedef struct {
     757        typedef [public] struct {
    774758                uint32 incoming_count;
    775759                lsa_TrustDomainInfoBuffer *incoming_current_auth_info;
     
    10411025        /**********************/
    10421026        /* Function 0x31 */
    1043         NTSTATUS lsa_SetTrustedDomainInfoByName(
     1027        [public] NTSTATUS lsa_SetTrustedDomainInfoByName(
    10441028                [in]                   policy_handle         *handle,
    1045                 [in]                   lsa_String             trusted_domain,
     1029                [in,ref]               lsa_String             *trusted_domain,
    10461030                [in]                   lsa_TrustDomInfoEnum   level,
    1047                 [in,unique,switch_is(level)] lsa_TrustedDomainInfo *info
     1031                [in,ref,switch_is(level)] lsa_TrustedDomainInfo *info
    10481032                );
    10491033
     
    10701054                [in]  lsa_TrustDomainInfoInfoEx   *info,
    10711055                [in]  lsa_TrustDomainInfoAuthInfoInternal *auth_info,
    1072                 [in]  uint32 access_mask,
     1056                [in]  lsa_TrustedAccessMask access_mask,
    10731057                [out] policy_handle               *trustdom_handle
    10741058                );
     
    10811065
    10821066        /* Function 0x35 */
     1067        typedef [bitmap32bit] bitmap {
     1068                LSA_POLICY_KERBEROS_VALIDATE_CLIENT = 0x00000080
     1069        } lsa_krbAuthenticationOptions;
    10831070
    10841071        /* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000
    1085            for unknown6 - gd */
    1086         typedef struct {
    1087                 uint32 enforce_restrictions;
     1072           for reserved - gd */
     1073        typedef struct {
     1074                lsa_krbAuthenticationOptions authentication_options;
    10881075                hyper service_tkt_lifetime;
    10891076                hyper user_tkt_lifetime;
    10901077                hyper user_tkt_renewaltime;
    10911078                hyper clock_skew;
    1092                 hyper unknown6;
     1079                hyper reserved;
    10931080        } lsa_DomainInfoKerberos;
    10941081
     
    11261113                [in]     policy_handle *handle,
    11271114                [in]         lsa_String     name,
    1128                 [in]         uint32        access_mask,
     1115                [in]     lsa_TrustedAccessMask access_mask,
    11291116                [out]    policy_handle *trustdom_handle
    11301117                );
     
    12011188                [in]  lsa_TrustDomainInfoInfoEx   *info,
    12021189                [in]  lsa_TrustDomainInfoAuthInfoInternal *auth_info,
    1203                 [in]  uint32                      access_mask,
     1190                [in]  lsa_TrustedAccessMask access_mask,
    12041191                [out] policy_handle               *trustdom_handle
    12051192                );
     
    12691256        /* Function 0x49 */
    12701257        typedef struct {
    1271                 [range(0,131072)] uint32 length;
     1258                [range(0,131072)] uint3264 length;
    12721259                [size_is(length)] uint8 *data;
    12731260        } lsa_ForestTrustBinaryData;
     
    12801267
    12811268        typedef [switch_type(uint32)] union {
    1282                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_String top_level_name;
     1269                [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_StringLarge top_level_name;
    12831270                [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex;
    12841271                [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info;
     
    12951282        typedef struct {
    12961283                uint32 flags;
    1297                 lsa_ForestTrustRecordType level;
    1298                 hyper unknown;
    1299                 [switch_is(level)] lsa_ForestTrustData forest_trust_data;
     1284                lsa_ForestTrustRecordType type;
     1285                hyper time;
     1286                [switch_is(type)] lsa_ForestTrustData forest_trust_data;
    13001287        } lsa_ForestTrustRecord;
    13011288
     
    13121299                );
    13131300
    1314         /* Function 0x4a */
    1315         [todo] NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION();
     1301        /*****************
     1302         * Function 0x4a */
     1303
     1304        typedef [v1_enum] enum {
     1305                LSA_FOREST_TRUST_COLLISION_TDO = 0,
     1306                LSA_FOREST_TRUST_COLLISION_XREF = 1,
     1307                LSA_FOREST_TRUST_COLLISION_OTHER = 2
     1308        } lsa_ForestTrustCollisionRecordType;
     1309
     1310        /* if type is CollisionTdo, flags can be */
     1311        typedef [bitmap32bit] bitmap {
     1312                LSA_TLN_DISABLED_NEW            = 0x00000001,
     1313                LSA_TLN_DISABLED_ADMIN          = 0x00000002,
     1314                LSA_TLN_DISABLED_CONFLICT       = 0x00000004
     1315        } lsa_ForestTrustCollisionTDOFlags;
     1316
     1317        /* if type is CollisionXref, flags can be */
     1318        typedef [bitmap32bit] bitmap {
     1319                LSA_SID_DISABLED_ADMIN          = 0x00000001,
     1320                LSA_SID_DISABLED_CONFLICT       = 0x00000002,
     1321                LSA_NB_DISABLED_ADMIN           = 0x00000004,
     1322                LSA_NB_DISABLED_CONFLICT        = 0x00000008
     1323        } lsa_ForestTrustCollisionXrefFlags;
     1324
     1325        typedef [nodiscriminant] union {
     1326                [case(LSA_FOREST_TRUST_COLLISION_TDO)] lsa_ForestTrustCollisionTDOFlags flags;
     1327                [case(LSA_FOREST_TRUST_COLLISION_XREF)] lsa_ForestTrustCollisionXrefFlags flags;
     1328                [default] uint32 flags;
     1329        } lsa_ForestTrustCollisionFlags;
     1330
     1331        typedef struct {
     1332                uint32 index;
     1333                lsa_ForestTrustCollisionRecordType type;
     1334                [switch_is(type)] lsa_ForestTrustCollisionFlags flags;
     1335                lsa_String name;
     1336        } lsa_ForestTrustCollisionRecord;
     1337
     1338        typedef struct {
     1339                uint32 count;
     1340                [size_is(count)] lsa_ForestTrustCollisionRecord **entries;
     1341        } lsa_ForestTrustCollisionInfo;
     1342
     1343        [public] NTSTATUS lsa_lsaRSetForestTrustInformation(
     1344                [in]      policy_handle *handle,
     1345                [in,ref]  lsa_StringLarge *trusted_domain_name,
     1346                [in]      uint16 highest_record_type,
     1347                [in,ref]  lsa_ForestTrustInformation *forest_trust_info,
     1348                [in]      uint8 check_only,
     1349                [out,ref] lsa_ForestTrustCollisionInfo **collision_info
     1350                );
    13161351
    13171352        /* Function 0x4b */
  • trunk/server/librpc/idl/mgmt.idl

    r414 r745  
    7171                [in]        uint32                  authn_proto,
    7272                [in]        uint32                  princ_name_size,
    73                 [out]       [string,charset(DOS)] uint8 princ_name[]
     73                [out]       [string,size_is(princ_name_size),charset(DOS)] uint8 princ_name[]
    7474                );
    7575}
  • trunk/server/librpc/idl/misc.idl

    r414 r745  
    2222        typedef [public] struct {
    2323                GUID uuid;
     24                /* The major version is encoded in the 16 least significant bits,
     25                   the minor in the 16 most significant bits. 
     26                   http://www.opengroup.org/onlinepubs/9629399/chap12.htm */
    2427                uint32 if_version;
    2528        } ndr_syntax_id;
     
    3538        typedef [public] enum {
    3639                SEC_CHAN_NULL        = 0,
     40                SEC_CHAN_LOCAL       = 1,
    3741                SEC_CHAN_WKSTA       = 2,
    3842                SEC_CHAN_DNS_DOMAIN  = 3,
    3943                SEC_CHAN_DOMAIN      = 4,
    40                 SEC_CHAN_BDC         = 6
     44                SEC_CHAN_LANMAN      = 5,
     45                SEC_CHAN_BDC         = 6,
     46                SEC_CHAN_RODC        = 7
    4147        } netr_SchannelType;
    4248
  • trunk/server/librpc/idl/named_pipe_auth.idl

    r414 r745  
    44*/
    55
    6 import "netlogon.idl";
     6import "netlogon.idl", "security.idl", "auth.idl";
    77
    88[
     
    2020                [charset(DOS),string] uint8 *server_addr;
    2121                uint16 server_port;
    22                 netr_SamInfo3 *sam_info3;
    23                 uint32 session_key_length;
    24                 [size_is(session_key_length)] uint8 *session_key;
    25         } named_pipe_auth_req_info2;
    26 
    27         typedef struct {
    28                 [charset(UTF8),string] uint8 *client_name;
    29                 [charset(DOS),string] uint8 *client_addr;
    30                 uint16 client_port;
    31                 [charset(UTF8),string] uint8 *server_name;
    32                 [charset(DOS),string] uint8 *server_addr;
    33                 uint16 server_port;
    34                 netr_SamInfo3 *sam_info3;
    35                 uint32 session_key_length;
    36                 [size_is(session_key_length)] uint8 *session_key;
    37                 uint32 gssapi_delegated_creds_length;
    38                 [size_is(gssapi_delegated_creds_length)]
    39                         uint8 *gssapi_delegated_creds;
    40         } named_pipe_auth_req_info3;
     22                auth_session_info_transport *session_info;
     23        } named_pipe_auth_req_info4;
    4124
    4225        typedef [switch_type(uint32)] union {
    43                 [case(0)] ;/* anonymous */
    44                 [case(1)] netr_SamInfo3 info1;
    45                 [case(2)] named_pipe_auth_req_info2 info2;
    46                 [case(3)] named_pipe_auth_req_info3 info3;
     26                [case(4)] named_pipe_auth_req_info4 info4;
    4727        } named_pipe_auth_req_info;
    4828
    4929        typedef [public,gensize] struct {
    5030                [flag(NDR_BIG_ENDIAN),
    51                  value(ndr_size_named_pipe_auth_req(r,ndr->iconv_convenience,ndr->flags)-4)]
     31                 value(ndr_size_named_pipe_auth_req(r,ndr->flags)-4)]
    5232                        uint32 length;
    5333                [charset(DOS),value(NAMED_PIPE_AUTH_MAGIC)] uint8 magic[4];
     
    6040                uint16 device_state;
    6141                hyper allocation_size;
    62         } named_pipe_auth_rep_info2;
    63 
    64         typedef struct {
    65                 uint16 file_type;
    66                 uint16 device_state;
    67                 hyper allocation_size;
    68         } named_pipe_auth_rep_info3;
     42        } named_pipe_auth_rep_info4;
    6943
    7044        typedef [switch_type(uint32)] union {
    71                 [case(0)] ;
    72                 [case(1)] ;
    73                 [case(2)] named_pipe_auth_rep_info2 info2;
    74                 [case(3)] named_pipe_auth_rep_info3 info3;
     45                [case(4)] named_pipe_auth_rep_info4 info4;
    7546        } named_pipe_auth_rep_info;
    7647
    7748        typedef [public,gensize] struct {
    7849                [flag(NDR_BIG_ENDIAN),
    79                  value(ndr_size_named_pipe_auth_rep(r,ndr->iconv_convenience,ndr->flags)-4)]
     50                 value(ndr_size_named_pipe_auth_rep(r,ndr->flags)-4)]
    8051                        uint32 length;
    8152                [charset(DOS),value(NAMED_PIPE_AUTH_MAGIC)] uint8 magic[4];
  • trunk/server/librpc/idl/nbt.idl

    r414 r745  
    1111import "misc.idl", "security.idl", "svcctl.idl", "samr.idl";
    1212[
    13         helper("../libcli/netlogon.h", "../libcli/nbt/libnbt.h")
     13        helper("../libcli/netlogon/netlogon.h", "../libcli/nbt/libnbt.h"),
     14        helpstring("NBT messages"),
     15        uuid("6def41b6-86e4-4c32-997c-ed33af7bcd8e")
    1416]
    1517interface nbt
     
    2426                NBT_FLAG_RECURSION_DESIRED  = 0x0100,
    2527                NBT_FLAG_TRUNCATION         = 0x0200,
    26                 NBT_FLAG_AUTHORITIVE        = 0x0400,
     28                NBT_FLAG_AUTHORITATIVE      = 0x0400,
    2729                NBT_OPCODE                  = 0x7800,
    2830                NBT_FLAG_REPLY              = 0x8000
     
    358360                NBT_SERVER_SELECT_SECRET_DOMAIN_6       = 0x00000800,
    359361                NBT_SERVER_FULL_SECRET_DOMAIN_6         = 0x00001000,
    360                 NBT_SERVER_DNS_FOREST                   = 0x01000000
     362                NBT_SERVER_ADS_WEB_SERVICE              = 0x00002000,
     363                NBT_SERVER_HAS_DNS_NAME                 = 0x20000000,
     364                NBT_SERVER_IS_DEFAULT_NC                = 0x40000000,
     365                NBT_SERVER_FOREST_ROOT                  = 0x80000000
    361366        } nbt_server_type;
    362367
     
    367372                NETLOGON_NT_VERSION_5EX_WITH_IP         = 0x00000008,
    368373                NETLOGON_NT_VERSION_WITH_CLOSEST_SITE   = 0x00000010,
    369                 NETLOGON_NT_VERSION_AVIOD_NT4EMUL       = 0x01000000,
     374                NETLOGON_NT_VERSION_AVOID_NT4EMUL       = 0x01000000,
    370375                NETLOGON_NT_VERSION_PDC                 = 0x10000000,
    371376                NETLOGON_NT_VERSION_IP                  = 0x20000000,
     
    375380
    376381        typedef [enum16bit,public] enum {
     382                LOGON_REQUEST                     = 0,
     383                LOGON_RESPONSE2                   = 6,
    377384                LOGON_PRIMARY_QUERY               = 7,  /* Was also NETLOGON_QUERY_FOR_PDC */
    378385                NETLOGON_ANNOUNCE_UAS             = 10,
     
    411418        } NETLOGON_SAM_LOGON_REQUEST;
    412419
     420        typedef struct {
     421                astring              computer_name;
     422                astring              user_name;
     423                astring              mailslot_name;
     424                uint8                request_count;
     425                uint16               lmnt_token;
     426                uint16               lm20_token;
     427        } NETLOGON_LOGON_REQUEST;
     428
    413429        typedef [flag(NDR_NOALIGN),public] struct {
    414430                netlogon_command command;
    415                 nstring              server;
     431                nstring              pdc_name;
    416432                nstring              user_name;
    417                 nstring              domain;
     433                nstring              domain_name;
    418434                netlogon_nt_version_flags               nt_version;
    419435                uint16               lmnt_token;
     
    449465                nbt_string           dns_domain;
    450466                nbt_string           pdc_dns_name;
    451                 nbt_string           domain;
     467                nbt_string           domain_name;
    452468                nbt_string           pdc_name;
    453469                nbt_string           user_name;
     
    456472
    457473                /* Optional on NETLOGON_NT_VERSION_5EX_WITH_IP */
    458                 [value(ndr_size_nbt_sockaddr(&sockaddr, ndr->iconv_convenience, ndr->flags))] uint8 sockaddr_size;
     474                [value(ndr_size_nbt_sockaddr(&sockaddr, ndr->flags))] uint8 sockaddr_size;
    459475                [subcontext(0),subcontext_size(sockaddr_size)] nbt_sockaddr sockaddr;
    460476
     
    479495
    480496        /* response from pdc */
    481         typedef [flag(NDR_NOALIGN),public] struct {
     497        typedef [public] struct {
    482498                netlogon_command command;
    483499                astring pdc_name;
     
    489505                uint16               lm20_token;
    490506        } nbt_netlogon_response_from_pdc;
     507
     508        typedef [flag(NDR_NOALIGN),public] struct {
     509                netlogon_command command;
     510                astring pdc_name;
     511                uint16 lm20_token;
     512        } nbt_netlogon_response2;
    491513
    492514        typedef enum netr_SamDatabaseID netr_SamDatabaseID;
     
    518540
    519541        typedef [nodiscriminant] union {
     542                [case(LOGON_REQUEST)]  NETLOGON_LOGON_REQUEST logon0;
    520543                [case(LOGON_SAM_LOGON_REQUEST)]       NETLOGON_SAM_LOGON_REQUEST logon;
    521544                [case(LOGON_PRIMARY_QUERY)] nbt_netlogon_query_for_pdc pdc;
     
    539562                [switch_is(command)] nbt_netlogon_request req;
    540563        } nbt_netlogon_packet;
     564
     565        void decode_nbt_netlogon_packet(
     566                [in] nbt_netlogon_packet packet
     567                );
    541568
    542569        /********************************************************/
  • trunk/server/librpc/idl/netlogon.idl

    r414 r745  
    55*/
    66
    7 import "misc.idl", "lsa.idl", "samr.idl", "security.idl", "nbt.idl";
     7import "misc.idl", "lsa.idl", "samr.idl", "security.idl";
    88
    99#include "idl_types.h"
     
    1717  endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"),
    1818  helper("../librpc/ndr/ndr_netlogon.h"),
     19  ms_union,
    1920  pointer_default(unique)
    2021]
     
    180181                [case(NetlogonNetworkTransitiveInformation)]     netr_NetworkInfo  *network;
    181182                [case(NetlogonServiceTransitiveInformation)]     netr_PasswordInfo *password;
     183                [default];
    182184        } netr_LogonLevel;
    183185
     
    252254                uint32 sidcount;
    253255                [size_is(sidcount)] netr_SidAttr *sids;
    254                 lsa_String forest;
     256                lsa_String dns_domainname;
    255257                lsa_String principle;
    256258                uint32 unknown4[20];
     
    292294                [case(NetlogonValidationGenericInfo2)] netr_GenericInfo2  *generic;
    293295                [case(NetlogonValidationSamInfo4)] netr_SamInfo6 *sam6;
     296                [default];
    294297        } netr_Validation;
    295298
     
    303306        } netr_Authenticator;
    304307
    305         NTSTATUS netr_LogonSamLogon(
     308        [public] NTSTATUS netr_LogonSamLogon(
    306309                [in,unique] [string,charset(UTF16)] uint16 *server_name,
    307310                [in,unique] [string,charset(UTF16)] uint16 *computer_name,
     
    603606
    604607        typedef struct {
    605                 uint16 unknown;
    606         } netr_DELTA_DELETE_TRUST;
    607 
    608         typedef struct {
    609608                uint32 privilege_entries;
    610609                uint32 privilege_control;
     
    624623                uint32 unknown8;
    625624        } netr_DELTA_ACCOUNT;
    626 
    627         typedef struct {
    628                 uint16 unknown;
    629         } netr_DELTA_DELETE_ACCOUNT;
    630 
    631         typedef struct {
    632                 uint16 unknown;
    633         } netr_DELTA_DELETE_SECRET;
    634625
    635626        typedef struct {
     
    695686                [case(NETR_DELTA_ALIAS_MEMBER)]    netr_DELTA_ALIAS_MEMBER    *alias_member;
    696687                [case(NETR_DELTA_POLICY)]          netr_DELTA_POLICY          *policy;
    697                 [case(NETR_DELTA_TRUSTED_DOMAIN)]  netr_DELTA_TRUSTED_DOMAIN   *trusted_domain;
    698                 [case(NETR_DELTA_DELETE_TRUST)]    netr_DELTA_DELETE_TRUST     delete_trust;
     688                [case(NETR_DELTA_TRUSTED_DOMAIN)]  netr_DELTA_TRUSTED_DOMAIN  *trusted_domain;
     689                [case(NETR_DELTA_DELETE_TRUST)]    ; /* sid only */
    699690                [case(NETR_DELTA_ACCOUNT)]         netr_DELTA_ACCOUNT         *account;
    700                 [case(NETR_DELTA_DELETE_ACCOUNT)]  netr_DELTA_DELETE_ACCOUNT   delete_account;
     691                [case(NETR_DELTA_DELETE_ACCOUNT)]  ; /* sid only */
    701692                [case(NETR_DELTA_SECRET)]          netr_DELTA_SECRET          *secret;
    702                 [case(NETR_DELTA_DELETE_SECRET)]   netr_DELTA_DELETE_SECRET    delete_secret;
     693                [case(NETR_DELTA_DELETE_SECRET)]   ; /* name only */
    703694                [case(NETR_DELTA_DELETE_GROUP2)]   netr_DELTA_DELETE_USER     *delete_group;
    704695                [case(NETR_DELTA_DELETE_USER2)]    netr_DELTA_DELETE_USER     *delete_user;
    705696                [case(NETR_DELTA_MODIFY_COUNT)]    udlong                     *modified_count;
     697                [default];
    706698        } netr_DELTA_UNION;
    707699
     
    729721                [case(NETR_DELTA_DELETE_USER2)]    uint32 rid;
    730722                [case(NETR_DELTA_MODIFY_COUNT)]    ;
     723                [default];
    731724        } netr_DELTA_ID_UNION;
    732725
     
    10501043                [in]     netr_Authenticator *credential,
    10511044                [in,out,ref] netr_Authenticator *return_authenticator,
    1052                 [in]     [subcontext(4),subcontext_size(change_log_entry_size)] netr_ChangeLogEntry change_log_entry,
    1053                 [in]     [value(ndr_size_netr_ChangeLogEntry(&change_log_entry, ndr->iconv_convenience, ndr->flags))] uint32 change_log_entry_size,
     1045                /*
     1046                 * we cannot use subcontext_size() here, as
     1047                 * change_log_entry_size is encoded after the subcontext
     1048                 */
     1049                [in]     [subcontext(4)/*,subcontext_size(change_log_entry_size)*/]
     1050                        netr_ChangeLogEntry change_log_entry,
     1051                [in]     [value(ndr_size_netr_ChangeLogEntry(&change_log_entry,
     1052                                ndr->flags))]
     1053                        uint32 change_log_entry_size,
    10541054                [out,ref]    netr_DELTA_ENUM_ARRAY **delta_enum_array
    10551055                );
     
    10741074        } netr_Blob;
    10751075
    1076         WERROR netr_NetrEnumerateTrustedDomains(
     1076        NTSTATUS netr_NetrEnumerateTrustedDomains(
    10771077                [in,unique] [string,charset(UTF16)] uint16 *server_name,
    10781078                [out,ref] netr_Blob *trusted_domains_blob
     
    10991099                                         DS_IS_FLAT_NAME |
    11001100                                         DS_IS_DNS_NAME |
     1101                                         DS_TRY_NEXTCLOSEST_SITE |
     1102                                         DS_DIRECTORY_SERVICE_6_REQUIRED |
     1103                                         DS_WEB_SERVICE_REQUIRED |
    11011104                                         DS_RETURN_FLAT_NAME |
    11021105                                         DS_RETURN_DNS_NAME);
     
    11311134
    11321135        typedef [bitmap32bit] bitmap {
    1133                 DS_SERVER_PDC                    = NBT_SERVER_PDC,
    1134                 DS_SERVER_GC                     = NBT_SERVER_GC,
    1135                 DS_SERVER_LDAP                   = NBT_SERVER_LDAP,
    1136                 DS_SERVER_DS                     = NBT_SERVER_DS,
    1137                 DS_SERVER_KDC                    = NBT_SERVER_KDC,
    1138                 DS_SERVER_TIMESERV               = NBT_SERVER_TIMESERV,
    1139                 DS_SERVER_CLOSEST                = NBT_SERVER_CLOSEST,
    1140                 DS_SERVER_WRITABLE               = NBT_SERVER_WRITABLE,
    1141                 DS_SERVER_GOOD_TIMESERV          = NBT_SERVER_GOOD_TIMESERV,
    1142                 DS_SERVER_NDNC                   = NBT_SERVER_NDNC,
    1143                 DS_SERVER_SELECT_SECRET_DOMAIN_6 = NBT_SERVER_SELECT_SECRET_DOMAIN_6,
    1144                 DS_SERVER_FULL_SECRET_DOMAIN_6   = NBT_SERVER_FULL_SECRET_DOMAIN_6,
     1136                DS_SERVER_PDC                    = 0x00000001,
     1137                DS_SERVER_GC                     = 0x00000004,
     1138                DS_SERVER_LDAP                   = 0x00000008,
     1139                DS_SERVER_DS                     = 0x00000010,
     1140                DS_SERVER_KDC                    = 0x00000020,
     1141                DS_SERVER_TIMESERV               = 0x00000040,
     1142                DS_SERVER_CLOSEST                = 0x00000080,
     1143                DS_SERVER_WRITABLE               = 0x00000100,
     1144                DS_SERVER_GOOD_TIMESERV          = 0x00000200,
     1145                DS_SERVER_NDNC                   = 0x00000400,
     1146                DS_SERVER_SELECT_SECRET_DOMAIN_6 = 0x00000800,
     1147                DS_SERVER_FULL_SECRET_DOMAIN_6   = 0x00001000,
    11451148                DS_DNS_CONTROLLER                = 0x20000000,
    11461149                DS_DNS_DOMAIN                    = 0x40000000,
    1147                 DS_DNS_FOREST                    = 0x80000000
     1150                DS_DNS_FOREST_ROOT               = 0x80000000
    11481151        } netr_DsR_DcFlags;
    11491152
     
    16211624        /****************/
    16221625        /* Function 0x2c */
    1623         WERROR netr_GetForestTrustInformation(
    1624                 [in,unique] [string,charset(UTF16)] uint16 *server_name,
    1625                 [in,ref] [string,charset(UTF16)] uint16 *trusted_domain_name,
     1626        NTSTATUS netr_GetForestTrustInformation(
     1627                [in,unique] [string,charset(UTF16)] uint16 *server_name,
     1628                [in,ref] [string,charset(UTF16)] uint16 *computer_name,
    16261629                [in,ref] netr_Authenticator *credential,
    16271630                [out,ref] netr_Authenticator *return_authenticator,
     
    16681671                [out,ref] netr_TrustInfo **trust_info
    16691672                );
     1673
     1674        /****************/
     1675        /* Function 0x2f */
     1676
     1677        NTSTATUS netr_Unused47(void);
     1678
     1679
     1680        /****************/
     1681        /* Function 0x30 */
     1682
     1683        typedef enum {
     1684                NlDnsLdapAtSite       = 22,
     1685                NlDnsGcAtSite         = 25,
     1686                NlDnsDsaCname         = 28,
     1687                NlDnsKdcAtSite        = 30,
     1688                NlDnsDcAtSite         = 32,
     1689                NlDnsRfc1510KdcAtSite = 34,
     1690                NlDnsGenericGcAtSite  = 36
     1691        } netr_DnsType;
     1692
     1693        typedef enum {
     1694                NlDnsInfoTypeNone    = 0,
     1695                NlDnsDomainName      = 1,
     1696                NlDnsDomainNameAlias = 2,
     1697                NlDnsForestName      = 3,
     1698                NlDnsForestNameAlias = 4,
     1699                NlDnsNdncDomainName  = 5,
     1700                NlDnsRecordName      = 6
     1701        } netr_DnsDomainInfoType;
     1702
     1703        typedef struct {
     1704                netr_DnsType type;
     1705                [string,charset(UTF16)] uint16 *dns_domain_info;
     1706                netr_DnsDomainInfoType dns_domain_info_type;
     1707                uint32 priority;
     1708                uint32 weight;
     1709                uint32 port;
     1710                boolean32 dns_register;
     1711                uint32 status;
     1712        } NL_DNS_NAME_INFO;
     1713
     1714        typedef [public] struct {
     1715                uint32 count;
     1716                [size_is(count)] NL_DNS_NAME_INFO *names;
     1717        } NL_DNS_NAME_INFO_ARRAY;
     1718
     1719        NTSTATUS netr_DsrUpdateReadOnlyServerDnsRecords(
     1720                [in,unique] [string,charset(UTF16)] uint16 *server_name,
     1721                [in,ref] [string,charset(UTF16)] uint16 *computer_name,
     1722                [in, ref] netr_Authenticator *credential,
     1723                [out,ref]   netr_Authenticator *return_authenticator,
     1724                [in,unique] [string,charset(UTF16)] uint16 *site_name,
     1725                [in] uint32 dns_ttl,
     1726                [in,out,ref] NL_DNS_NAME_INFO_ARRAY *dns_names
     1727                );
    16701728}
  • trunk/server/librpc/idl/ntlmssp.idl

    r414 r745  
    8787        /* [MS-NLMP] 2.2.2.10 VERSION */
    8888
    89         typedef struct {
     89        typedef [public] struct {
    9090                ntlmssp_WindowsMajorVersion ProductMajorVersion;
    9191                ntlmssp_WindowsMinorVersion ProductMinorVersion;
     
    9393                uint8 Reserved[3];
    9494                ntlmssp_NTLMRevisionCurrent NTLMRevisionCurrent;
    95         } VERSION;
     95        } ntlmssp_VERSION;
    9696
    9797        typedef [noprint,nodiscriminant] union {
    98                 [case(NTLMSSP_NEGOTIATE_VERSION)] VERSION version;
     98                [case(NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_VERSION version;
    9999                [default];
    100100        } ntlmssp_Version;
     
    106106                [value(NtLmNegotiate)] ntlmssp_MessageType MessageType;
    107107                NEGOTIATE NegotiateFlags;
    108                 [value(strlen(DomainName))] uint16 DomainNameLen;
     108                [value(DomainName ? strlen(DomainName) : 0)] uint16 DomainNameLen;
    109109                [value(DomainNameLen)] uint16 DomainNameMaxLen;
    110110                [relative] [subcontext(0),subcontext_size(DomainNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM))] string *DomainName;
    111                 [value(strlen(Workstation))] uint16 WorkstationLen;
     111                [value(Workstation ? strlen(Workstation) : 0)] uint16 WorkstationLen;
    112112                [value(WorkstationLen)] uint16 WorkstationMaxLen;
    113113                [relative] [subcontext(0),subcontext_size(WorkstationLen)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM))] string *Workstation;
     
    163163        typedef [public,flag(NDR_NOALIGN)] struct {
    164164                ntlmssp_AvId AvId;
    165                 [value(ndr_size_ntlmssp_AvValue(&r->Value, r->AvId, ndr->iconv_convenience, 0))] uint16 AvLen;
     165                [value(ndr_size_ntlmssp_AvValue(&r->Value, r->AvId, 0))] uint16 AvLen;
    166166                [subcontext(0),subcontext_size(AvLen),switch_is(AvId)] ntlmssp_AvValue Value;
    167167        } AV_PAIR;
     
    183183                uint8 ServerChallenge[8];
    184184                uint8 Reserved[8];
    185                 [value(ndr_size_AV_PAIR_LIST(TargetInfo, ndr->iconv_convenience, ndr->flags))] uint16 TargetInfoLen;
     185                [value(ndr_size_AV_PAIR_LIST(TargetInfo, ndr->flags))] uint16 TargetInfoLen;
    186186                [value(TargetInfoLen)] uint16 TargetNameInfoMaxLen;
    187187                [relative] [subcontext(0),subcontext_size(TargetInfoLen)] AV_PAIR_LIST *TargetInfo;
     
    314314                );
    315315
     316        void decode_NTLMv2_RESPONSE(
     317                [in] NTLMv2_RESPONSE response
     318                );
     319
    316320}
  • trunk/server/librpc/idl/samr.idl

    r414 r745  
    2424                SAM_DATABASE_PRIVS   = 2 /* Privileges */
    2525        } netr_SamDatabaseID;
    26 
    27         typedef [public,v1_enum] enum {
    28                 SAMR_REJECT_OTHER      = 0,
    29                 SAMR_REJECT_TOO_SHORT  = 1,
    30                 SAMR_REJECT_IN_HISTORY = 2,
    31                 SAMR_REJECT_COMPLEXITY = 5
    32         } samr_RejectReason;
    33 
    34 
    3526
    3627        /* account control (acct_flags) bits */
     
    5445                ACB_DONT_REQUIRE_PREAUTH        = 0x00010000,  /* 1 = Preauth not required */
    5546                ACB_PW_EXPIRED                  = 0x00020000,  /* 1 = Password Expired */
    56                 ACB_NO_AUTH_DATA_REQD           = 0x00080000   /* 1 = No authorization data required */
     47                ACB_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION = 0x00040000,
     48                ACB_NO_AUTH_DATA_REQD           = 0x00080000,  /* 1 = No authorization data required */
     49                ACB_PARTIAL_SECRETS_ACCOUNT     = 0x00100000,
     50                ACB_USE_AES_KEYS                = 0x00200000
    5751        } samr_AcctFlags;
    5852
     
    665659                uint32 count;
    666660                [size_is(count)] uint32 *rids;
    667                 [size_is(count)] uint32 *types;
    668         } samr_RidTypeArray;
     661                [size_is(count)] samr_GroupAttrs *attributes;
     662        } samr_RidAttrArray;
    669663
    670664        NTSTATUS samr_QueryGroupMember(
    671665                [in,ref]  policy_handle *group_handle,
    672                 [out,ref] samr_RidTypeArray **rids
     666                [out,ref] samr_RidAttrArray **rids
    673667                );
    674668
     
    816810        typedef struct {
    817811                lsa_String comment;
    818                 lsa_String unknown; /* settable, but doesn't stick. probably obsolete */
     812                lsa_String reserved; /* settable, but doesn't stick. probably obsolete */
    819813                uint16 country_code;
    820814                uint16 code_page;
     
    992986                lsa_BinaryString lm_owf_password;
    993987                lsa_BinaryString nt_owf_password;
    994                 lsa_String unknown3;
     988                lsa_String private_data;
    995989                uint32 buf_count;
    996990                [size_is(buf_count)] uint8 *buffer;
     
    10071001                uint8  nt_password_set;
    10081002                uint8  password_expired;
    1009                 uint8  unknown4;
     1003                uint8  private_data_sensitive;
    10101004        } samr_UserInfo21;
    10111005
     
    14481442        /* Function    0x3f     */
    14491443
    1450         typedef enum samr_RejectReason samr_RejectReason;
    1451 
    1452         typedef struct {
    1453                 samr_RejectReason reason;
    1454                 uint32 unknown1;
    1455                 uint32 unknown2;
    1456         } samr_ChangeReject;
    1457 
    1458         NTSTATUS samr_ChangePasswordUser3(
     1444        typedef [public,v1_enum] enum {
     1445                SAM_PWD_CHANGE_NO_ERROR             = 0,
     1446                SAM_PWD_CHANGE_PASSWORD_TOO_SHORT   = 1,
     1447                SAM_PWD_CHANGE_PWD_IN_HISTORY       = 2,
     1448                SAM_PWD_CHANGE_USERNAME_IN_PASSWORD = 3,
     1449                SAM_PWD_CHANGE_FULLNAME_IN_PASSWORD = 4,
     1450                SAM_PWD_CHANGE_NOT_COMPLEX          = 5,
     1451                SAM_PWD_CHANGE_MACHINE_NOT_DEFAULT  = 6,
     1452                SAM_PWD_CHANGE_FAILED_BY_FILTER     = 7,
     1453                SAM_PWD_CHANGE_PASSWORD_TOO_LONG    = 8
     1454        } samPwdChangeReason;
     1455
     1456        typedef struct {
     1457                samPwdChangeReason extendedFailureReason;
     1458                [string,charset(UTF16)] uint16 *filterModuleName;
     1459        } userPwdChangeFailureInformation;
     1460
     1461        [public] NTSTATUS samr_ChangePasswordUser3(
    14591462                [in,unique]       lsa_String *server,
    14601463                [in,ref]          lsa_String *account,
     
    14661469                [in,unique]       samr_CryptPassword *password3,
    14671470                [out,ref]         samr_DomInfo1 **dominfo,
    1468                 [out,ref]         samr_ChangeReject **reject
     1471                [out,ref]         userPwdChangeFailureInformation **reject
    14691472                );
    14701473
  • trunk/server/librpc/idl/schannel.idl

    r414 r745  
    9191        } NL_AUTH_SIGNATURE;
    9292
     93        const int NL_AUTH_SIGNATURE_SIZE = 0x20;
     94
    9395        /* MS-NRPC 2.2.1.3.3 NL_AUTH_SHA2_SIGNATURE */
    9496
  • trunk/server/librpc/idl/security.idl

    r414 r745  
    3232interface security
    3333{
     34
     35        typedef bitmap lsa_SystemAccessModeFlags lsa_SystemAccessModeFlags;
    3436
    3537        typedef [public,gensize,noprint,nosize,nopull,nopush] struct {
     
    263265        const string SID_BUILTIN_REMOTE_DESKTOP_USERS   = "S-1-5-32-555";
    264266        const string SID_BUILTIN_NETWORK_CONF_OPERATORS = "S-1-5-32-556";
     267        const string SID_BUILTIN_INCOMING_FOREST_TRUST  = "S-1-5-32-557";
     268        const string SID_BUILTIN_PERFMON_USERS          = "S-1-5-32-558";
     269        const string SID_BUILTIN_PERFLOG_USERS          = "S-1-5-32-559";
     270        const string SID_BUILTIN_AUTH_ACCESS            = "S-1-5-32-560";
     271        const string SID_BUILTIN_TS_LICENSE_SERVERS     = "S-1-5-32-561";
     272
     273        /* SECURITY_NT_SERVICE */
     274        const string NAME_NT_SERVICE            = "NT SERVICE";
     275
     276        const string SID_NT_NT_SERVICE          = "S-1-5-80";
     277        const string SID_NT_TRUSTED_INSTALLER =
     278                "S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464";
    265279
    266280        /* well-known domain RIDs */
    267         const int DOMAIN_RID_LOGON                 = 9;
    268         const int DOMAIN_RID_ADMINISTRATOR         = 500;
    269         const int DOMAIN_RID_GUEST                 = 501;
    270         const int DOMAIN_RID_KRBTGT                = 502;
    271         const int DOMAIN_RID_ADMINS                = 512;
    272         const int DOMAIN_RID_USERS                 = 513;
    273         const int DOMAIN_RID_GUESTS                = 514;
    274         const int DOMAIN_RID_DOMAIN_MEMBERS        = 515;
    275         const int DOMAIN_RID_DCS                   = 516;
    276         const int DOMAIN_RID_CERT_ADMINS           = 517;
    277         const int DOMAIN_RID_SCHEMA_ADMINS         = 518;
    278         const int DOMAIN_RID_ENTERPRISE_ADMINS     = 519;
    279         const int DOMAIN_RID_POLICY_ADMINS         = 520;
    280 
    281 
    282         /*
    283           privilege IDs. Please keep the IDs below 64. If we get more
    284           than 64 then we need to change security_token
    285         */
     281        const int DOMAIN_RID_LOGON                   = 9;
     282        const int DOMAIN_RID_ENTERPRISE_READONLY_DCS = 498;
     283        const int DOMAIN_RID_ADMINISTRATOR           = 500;
     284        const int DOMAIN_RID_GUEST                   = 501;
     285        const int DOMAIN_RID_KRBTGT                  = 502;
     286        const int DOMAIN_RID_ADMINS                  = 512;
     287        const int DOMAIN_RID_USERS                   = 513;
     288        const int DOMAIN_RID_GUESTS                  = 514;
     289        const int DOMAIN_RID_DOMAIN_MEMBERS          = 515;
     290        const int DOMAIN_RID_DCS                     = 516;
     291        const int DOMAIN_RID_CERT_ADMINS             = 517;
     292        const int DOMAIN_RID_SCHEMA_ADMINS           = 518;
     293        const int DOMAIN_RID_ENTERPRISE_ADMINS       = 519;
     294        const int DOMAIN_RID_POLICY_ADMINS           = 520;
     295        const int DOMAIN_RID_READONLY_DCS            = 521;
     296        const int DOMAIN_RID_RAS_SERVERS             = 553;
     297        const int DOMAIN_RID_RODC_ALLOW              = 571;
     298        const int DOMAIN_RID_RODC_DENY               = 572;
     299
     300        /* well-known builtin RIDs */
     301        const int BUILTIN_RID_ADMINISTRATORS            = 544;
     302        const int BUILTIN_RID_USERS                     = 545;
     303        const int BUILTIN_RID_GUESTS                    = 546;
     304        const int BUILTIN_RID_POWER_USERS               = 547;
     305        const int BUILTIN_RID_ACCOUNT_OPERATORS         = 548;
     306        const int BUILTIN_RID_SERVER_OPERATORS          = 549;
     307        const int BUILTIN_RID_PRINT_OPERATORS           = 550;
     308        const int BUILTIN_RID_BACKUP_OPERATORS          = 551;
     309        const int BUILTIN_RID_REPLICATOR                = 552;
     310        const int BUILTIN_RID_RAS_SERVERS               = 553;
     311        const int BUILTIN_RID_PRE_2K_ACCESS             = 554;
     312        const int BUILTIN_RID_REMOTE_DESKTOP_USERS      = 555;
     313        const int BUILTIN_RID_NETWORK_CONF_OPERATORS    = 556;
     314        const int BUILTIN_RID_INCOMING_FOREST_TRUST     = 557;
     315        const int BUILTIN_RID_PERFMON_USERS             = 558;
     316        const int BUILTIN_RID_PERFLOG_USERS             = 559;
     317        const int BUILTIN_RID_AUTH_ACCESS               = 560;
     318        const int BUILTIN_RID_TS_LICENSE_SERVERS        = 561;
     319
     320/********************************************************************
     321 This is a list of privileges reported by a WIndows 2008 R2 DC
     322 just for reference purposes (and I know the LUID is not guaranteed
     323 across reboots):
     324
     3250x00000002          SeCreateTokenPrivilege "Create a token object"
     3260x00000003   SeAssignPrimaryTokenPrivilege "Replace a process level token"
     3270x00000004           SeLockMemoryPrivilege "Lock pages in memory"
     3280x00000005        SeIncreaseQuotaPrivilege "Adjust memory quotas for a process"
     3290x00000006       SeMachineAccountPrivilege "Add workstations to domain"
     3300x00000007                  SeTcbPrivilege "Act as part of the operating system"
     3310x00000008             SeSecurityPrivilege "Manage auditing and security log"
     3320x00000009        SeTakeOwnershipPrivilege "Take ownership of files or other objects"
     3330x0000000a           SeLoadDriverPrivilege "Load and unload device drivers"
     3340x0000000b        SeSystemProfilePrivilege "Profile system performance"
     3350x0000000c           SeSystemtimePrivilege "Change the system time"
     3360x0000000d SeProfileSingleProcessPrivilege "Profile single process"
     3370x0000000e SeIncreaseBasePriorityPrivilege "Increase scheduling priority"
     3380x0000000f       SeCreatePagefilePrivilege "Create a pagefile"
     3390x00000010      SeCreatePermanentPrivilege "Create permanent shared objects"
     3400x00000011               SeBackupPrivilege "Back up files and directories"
     3410x00000012              SeRestorePrivilege "Restore files and directories"
     3420x00000013             SeShutdownPrivilege "Shut down the system"
     3430x00000014                SeDebugPrivilege "Debug programs"
     3440x00000015                SeAuditPrivilege "Generate security audits"
     3450x00000016    SeSystemEnvironmentPrivilege "Modify firmware environment values"
     3460x00000017         SeChangeNotifyPrivilege "Bypass traverse checking"
     3470x00000018       SeRemoteShutdownPrivilege "Force shutdown from a remote system"
     3480x00000019               SeUndockPrivilege "Remove computer from docking station"
     3490x0000001a            SeSyncAgentPrivilege "Synchronize directory service data"
     3500x0000001b     SeEnableDelegationPrivilege "Enable computer and user accounts to be trusted for delegation"
     3510x0000001c         SeManageVolumePrivilege "Perform volume maintenance tasks"
     3520x0000001d          SeImpersonatePrivilege "Impersonate a client after authentication"
     3530x0000001e         SeCreateGlobalPrivilege "Create global objects"
     3540x0000001f SeTrustedCredManAccessPrivilege "Access Credential Manager as a trusted caller"
     3550x00000020              SeRelabelPrivilege "Modify an object label"
     3560x00000021   SeIncreaseWorkingSetPrivilege "Increase a process working set"
     3570x00000022             SeTimeZonePrivilege "Change the time zone"
     3580x00000023   SeCreateSymbolicLinkPrivilege "Create symbolic links"
     359
     360 ********************************************************************/
     361
     362        /* LUID values for privileges known about by Samba (bottom 32 bits of enum, top bits are 0) */
     363
     364        /* we have to define the LUID here due to a horrible check by printmig.exe
     365           that requires the SeBackupPrivilege match what is in Windows.  So match
     366           those that we implement and start Samba privileges at 0x1001 */
     367
    286368        typedef enum {
    287                 SEC_PRIV_SECURITY                  = 1,
    288                 SEC_PRIV_BACKUP                    = 2,
    289                 SEC_PRIV_RESTORE                   = 3,
    290                 SEC_PRIV_SYSTEMTIME                = 4,
    291                 SEC_PRIV_SHUTDOWN                  = 5,
    292                 SEC_PRIV_REMOTE_SHUTDOWN           = 6,
    293                 SEC_PRIV_TAKE_OWNERSHIP            = 7,
    294                 SEC_PRIV_DEBUG                     = 8,
    295                 SEC_PRIV_SYSTEM_ENVIRONMENT        = 9,
    296                 SEC_PRIV_SYSTEM_PROFILE            = 10,
    297                 SEC_PRIV_PROFILE_SINGLE_PROCESS    = 11,
    298                 SEC_PRIV_INCREASE_BASE_PRIORITY    = 12,
    299                 SEC_PRIV_LOAD_DRIVER               = 13,
    300                 SEC_PRIV_CREATE_PAGEFILE           = 14,
    301                 SEC_PRIV_INCREASE_QUOTA            = 15,
    302                 SEC_PRIV_CHANGE_NOTIFY             = 16,
    303                 SEC_PRIV_UNDOCK                    = 17,
    304                 SEC_PRIV_MANAGE_VOLUME             = 18,
    305                 SEC_PRIV_IMPERSONATE               = 19,
    306                 SEC_PRIV_CREATE_GLOBAL             = 20,
    307                 SEC_PRIV_ENABLE_DELEGATION         = 21,
    308                 SEC_PRIV_INTERACTIVE_LOGON         = 22,
    309                 SEC_PRIV_NETWORK_LOGON             = 23,
    310                 SEC_PRIV_REMOTE_INTERACTIVE_LOGON  = 24,
    311                 SEC_PRIV_MACHINE_ACCOUNT           = 25
     369                SEC_PRIV_INVALID                   = 0x0,
     370                SEC_PRIV_INCREASE_QUOTA            = 0x5,
     371                SEC_PRIV_MACHINE_ACCOUNT           = 0x6,
     372                SEC_PRIV_SECURITY                  = 0x8,
     373                SEC_PRIV_TAKE_OWNERSHIP            = 0x09,
     374                SEC_PRIV_LOAD_DRIVER               = 0x0a,
     375                SEC_PRIV_SYSTEM_PROFILE            = 0x0b,
     376                SEC_PRIV_SYSTEMTIME                = 0x0c,
     377                SEC_PRIV_PROFILE_SINGLE_PROCESS    = 0x0d,
     378                SEC_PRIV_INCREASE_BASE_PRIORITY    = 0x0e,
     379                SEC_PRIV_CREATE_PAGEFILE           = 0x0f,
     380                SEC_PRIV_BACKUP                    = 0x11,
     381                SEC_PRIV_RESTORE                   = 0x12,
     382                SEC_PRIV_SHUTDOWN                  = 0x13,
     383                SEC_PRIV_DEBUG                     = 0x14,
     384                SEC_PRIV_SYSTEM_ENVIRONMENT        = 0x16,
     385                SEC_PRIV_CHANGE_NOTIFY             = 0x17,
     386                SEC_PRIV_REMOTE_SHUTDOWN           = 0x18,
     387                SEC_PRIV_UNDOCK                    = 0x19,
     388                SEC_PRIV_ENABLE_DELEGATION         = 0x1b,
     389                SEC_PRIV_MANAGE_VOLUME             = 0x1c,
     390                SEC_PRIV_IMPERSONATE               = 0x1d,
     391                SEC_PRIV_CREATE_GLOBAL             = 0x1e,
     392                /* Samba-specific privs */
     393                SEC_PRIV_PRINT_OPERATOR            = 0x1001,
     394                SEC_PRIV_ADD_USERS                 = 0x1002,
     395                SEC_PRIV_DISK_OPERATOR             = 0x1003
    312396        } sec_privilege;
    313397
     398
     399        /* Bitmap of privilege values for internal use only.  We need
     400         * our own bitmap here as privilages.tdb records these values
     401         * as a bitmap (privilages.ldb uses the string forms).
     402         */
     403        typedef [bitmap64bit] bitmap {
     404                SEC_PRIV_MACHINE_ACCOUNT_BIT            = 0x00000010,
     405
     406                /* Samba-specific privs */
     407                SEC_PRIV_PRINT_OPERATOR_BIT             = 0x00000020,
     408                SEC_PRIV_ADD_USERS_BIT                  = 0x00000040,
     409                SEC_PRIV_DISK_OPERATOR_BIT              = 0x00000080,
     410
     411                SEC_PRIV_REMOTE_SHUTDOWN_BIT            = 0x00000100,
     412                SEC_PRIV_BACKUP_BIT                     = 0x00000200,
     413                SEC_PRIV_RESTORE_BIT                    = 0x00000400,
     414                SEC_PRIV_TAKE_OWNERSHIP_BIT             = 0x00000800,
     415                /* End of privilages implemented before merge to common code */
     416
     417                SEC_PRIV_INCREASE_QUOTA_BIT               = 0x00001000,
     418                SEC_PRIV_SECURITY_BIT                     = 0x00002000,
     419                SEC_PRIV_LOAD_DRIVER_BIT                  = 0x00004000,
     420                SEC_PRIV_SYSTEM_PROFILE_BIT               = 0x00008000,
     421                SEC_PRIV_SYSTEMTIME_BIT                   = 0x00010000,
     422                SEC_PRIV_PROFILE_SINGLE_PROCESS_BIT       = 0x00020000,
     423                SEC_PRIV_INCREASE_BASE_PRIORITY_BIT       = 0x00040000,
     424                SEC_PRIV_CREATE_PAGEFILE_BIT              = 0x00080000,
     425                SEC_PRIV_SHUTDOWN_BIT                     = 0x00100000,
     426                SEC_PRIV_DEBUG_BIT                        = 0x00200000,
     427                SEC_PRIV_SYSTEM_ENVIRONMENT_BIT           = 0x00400000,
     428                SEC_PRIV_CHANGE_NOTIFY_BIT                = 0x00800000,
     429                SEC_PRIV_UNDOCK_BIT                       = 0x01000000,
     430                SEC_PRIV_ENABLE_DELEGATION_BIT            = 0x02000000,
     431                SEC_PRIV_MANAGE_VOLUME_BIT                = 0x04000000,
     432                SEC_PRIV_IMPERSONATE_BIT                  = 0x08000000,
     433                SEC_PRIV_CREATE_GLOBAL_BIT                = 0x10000000
     434        } se_privilege;
     435
     436        typedef [bitmap32bit] bitmap {
     437                LSA_POLICY_MODE_INTERACTIVE             = 0x00000001,
     438                LSA_POLICY_MODE_NETWORK                 = 0x00000002,
     439                LSA_POLICY_MODE_BATCH                   = 0x00000004,
     440                LSA_POLICY_MODE_SERVICE                 = 0x00000010,
     441                LSA_POLICY_MODE_PROXY                   = 0x00000020,
     442                LSA_POLICY_MODE_DENY_INTERACTIVE        = 0x00000040,
     443                LSA_POLICY_MODE_DENY_NETWORK            = 0x00000080,
     444                LSA_POLICY_MODE_DENY_BATCH              = 0x00000100,
     445                LSA_POLICY_MODE_DENY_SERVICE            = 0x00000200,
     446                LSA_POLICY_MODE_REMOTE_INTERACTIVE      = 0x00000400,
     447                LSA_POLICY_MODE_DENY_REMOTE_INTERACTIVE = 0x00000800,
     448                LSA_POLICY_MODE_ALL                     = 0x00000FF7,
     449                LSA_POLICY_MODE_ALL_NT4                 = 0x00000037
     450        } lsa_SystemAccessModeFlags;
    314451
    315452        typedef [public,bitmap8bit] bitmap {
     
    372509                security_ace_type type;  /* SEC_ACE_TYPE_* */
    373510                security_ace_flags flags; /* SEC_ACE_FLAG_* */
    374                 [value(ndr_size_security_ace(r,ndr->iconv_convenience,ndr->flags))] uint16 size;
     511                [value(ndr_size_security_ace(r,ndr->flags))] uint16 size;
    375512                uint32 access_mask;
    376513                [switch_is(type)] security_ace_object_ctr object;
     
    387524        typedef [public,gensize,nosize] struct {
    388525                security_acl_revision revision;
    389                 [value(ndr_size_security_acl(r,ndr->iconv_convenience,ndr->flags))] uint16 size;
     526                [value(ndr_size_security_acl(r,ndr->flags))] uint16 size;
    390527                [range(0,1000)] uint32 num_aces;
    391528                security_ace aces[num_aces];
     
    429566
    430567        typedef [public] struct {
    431                 [range(0,0x40000),value(ndr_size_security_descriptor(sd,ndr->iconv_convenience,ndr->flags))] uint32 sd_size;
     568                [range(0,0x40000),value(ndr_size_security_descriptor(sd,ndr->flags))] uint32 sd_size;
    432569                [subcontext(4)] security_descriptor *sd;
    433570        } sec_desc_buf;
    434571
     572        /* This is not yet sent over the network, but is simply defined in IDL */
    435573        typedef [public] struct {
    436                 dom_sid *user_sid;
    437                 dom_sid *group_sid;
    438574                uint32 num_sids;
    439                 [size_is(num_sids)] dom_sid *sids[*];
    440                 udlong privilege_mask;
    441                 security_acl *default_dacl;
     575                [size_is(num_sids)] dom_sid sids[*];
     576                se_privilege privilege_mask;
     577                lsa_SystemAccessModeFlags rights_mask;
    442578        } security_token;
     579
     580        /* This is not yet sent over the network, but is simply defined in IDL */
     581        typedef [public] struct {
     582                uid_t uid;
     583                uid_t gid;
     584                uint32 ngroups;
     585                [size_is(ngroups)] gid_t groups[*];
     586        } security_unix_token;
    443587
    444588        /* bits that determine which parts of a security descriptor
     
    470614                SEC_GROUP_FROM_PARENT                = 0x00000010
    471615        } security_autoinherit;
     616
     617        /***************************************************************/
     618        /* Extended right guids */
     619
     620        const string GUID_DRS_ALLOCATE_RIDS           = "1abd7cf8-0a99-11d1-adbb-00c04fd8d5cd";
     621        const string GUID_DRS_CHANGE_DOMAIN_MASTER    = "014bf69c-7b3b-11d1-85f6-08002be74fab";
     622        const string GUID_DRS_CHANGE_INFR_MASTER      = "cc17b1fb-33d9-11d2-97d4-00c04fd8d5cd";
     623        const string GUID_DRS_CHANGE_PDC              = "bae50096-4752-11d1-9052-00c04fc2d4cf";
     624        const string GUID_DRS_CHANGE_RID_MASTER       = "d58d5f36-0a98-11d1-adbb-00c04fd8d5cd";
     625        const string GUID_DRS_CHANGE_SCHEMA_MASTER    = "e12b56b6-0a95-11d1-adbb-00c04fd8d5cd";
     626        const string GUID_DRS_GET_CHANGES             = "1131f6aa-9c07-11d1-f79f-00c04fc2dcd2";
     627        const string GUID_DRS_GET_ALL_CHANGES         = "1131f6ad-9c07-11d1-f79f-00c04fc2dcd2";
     628        const string GUID_DRS_GET_FILTERED_ATTRIBUTES = "89e95b76-444d-4c62-991a-0facbeda640c";
     629        const string GUID_DRS_MANAGE_TOPOLOGY         = "1131f6ac-9c07-11d1-f79f-00c04fc2dcd2";
     630        const string GUID_DRS_MONITOR_TOPOLOGY        = "f98340fb-7c5b-4cdb-a00b-2ebdfa115a96";
     631        const string GUID_DRS_REPL_SYNCRONIZE         = "1131f6ab-9c07-11d1-f79f-00c04fc2dcd2";
     632        const string GUID_DRS_RO_REPL_SECRET_SYNC     = "1131f6ae-9c07-11d1-f79f-00c04fc2dcd2";
     633        const string GUID_DRS_USER_CHANGE_PASSWORD    = "ab721a53-1e2f-11d0-9819-00aa0040529b";
     634        const string GUID_DRS_FORCE_CHANGE_PASSWORD   = "00299570-246d-11d0-a768-00aa006e0529";
     635
     636        /***************************************************************/
     637        /* validated writes guids */
     638        const string GUID_DRS_VALIDATE_SPN            = "f3a64788-5306-11d1-a9c5-0000f80367c1";
     639        const string GUID_DRS_SELF_MEMBERSHIP         = "bf9679c0-0de6-11d0-a285-00aa003049e2";
     640        const string GUID_DRS_DNS_HOST_NAME           = "72e39547-7b18-11d1-adef-00c04fd8d5cd";
     641        const string GUID_DRS_ADD_DNS_HOST_NAME       = "80863791-dbe9-4eb8-837e-7f0ab55d9ac7";
     642        const string GUID_DRS_BEHAVIOR_VERSION        = "d31a8757-2447-4545-8081-3bb610cacbf2";
     643
     644        /* A type to describe the mapping of generic access rights to object
     645           specific access rights. */
     646
     647        typedef struct {
     648                uint32 generic_read;
     649                uint32 generic_write;
     650                uint32 generic_execute;
     651                uint32 generic_all;
     652        } generic_mapping;
     653
     654        typedef struct {
     655                uint32 std_read;
     656                uint32 std_write;
     657                uint32 std_execute;
     658                uint32 std_all;
     659        } standard_mapping;
    472660}
  • trunk/server/librpc/idl/spoolss.idl

    r596 r745  
    3030
    3131        typedef struct {
    32                 [value(ndr_size_spoolss_Time(time, ndr->iconv_convenience, ndr->flags))] uint32 size;
     32                [value(ndr_size_spoolss_Time(time, ndr->flags))] uint32 size;
    3333                [unique] spoolss_Time *time;
    3434        } spoolss_TimeCtr;
     
    120120        } spoolss_JobStatus;
    121121
     122        typedef [v1_enum] enum {
     123                SPOOLSS_DEBUGGING_BUILD         = 0x00000000,
     124                SPOOLSS_RELEASE_BUILD           = 0x00000001
     125        } spoolss_Build;
     126
    122127        typedef [public,gensize] struct {
    123128                [relative] nstring *printername;
     
    130135                uint32 total_pages;
    131136                uint32 version;
    132                 uint32 free_build;
     137                spoolss_Build free_build;
    133138                uint32 spooling;
    134139                uint32 max_spooling;
     
    151156                uint32 reserved3;
    152157        } spoolss_PrinterInfo0;
     158
     159        /* Device Mode Extra Data */
     160
     161        typedef [v1_enum] enum {
     162                SPOOLSS_DM_SIGNATURE_UNIDRVEXTRA        = 0x554e4944, /* 0x44494e55 */
     163                SPOOLSS_DM_SIGNATURE_JTEXP              = 0x4a544d53, /* 0x534d544a */
     164                SPOOLSS_DM_SIGNATURE_PSEXTRA            = 0x50524956 /* 0x56495250 */
     165        } spoolss_DM_Signature;
     166
     167        typedef [v1_enum] enum {
     168                SPOOLSS_DM_LAYOUT_NUP_DISABLED          = 0x00000000,
     169                SPOOLSS_DM_LAYOUT_NUP_2                 = 0x00000001,
     170                SPOOLSS_DM_LAYOUT_NUP_4                 = 0x00000002,
     171                SPOOLSS_DM_LAYOUT_NUP_6                 = 0x00000003,
     172                SPOOLSS_DM_LAYOUT_NUP_9                 = 0x00000004,
     173                SPOOLSS_DM_LAYOUT_NUP_16                = 0x00000005,
     174                SPOOLSS_DM_LAYOUT_BOOKLET               = 0x00000006
     175        } spoolss_DM_Layout;
     176
     177        typedef [v1_enum] enum {
     178                SPOOLSS_DM_NUP_DIRECTION_L2R_T2B        = 0x00000001,
     179                SPOOLSS_DM_NUP_DIRECTION_T2B_L2R        = 0x00000002,
     180                SPOOLSS_DM_NUP_DIRECTION_R2L_T2B        = 0x00000004,
     181                SPOOLSS_DM_NUP_DIRECTION_T2B_R2L        = 0x00000008
     182        } spoolss_DM_NupDirection;
     183
     184        typedef [v1_enum] enum {
     185                SPOOLSS_DM_NUP_BORDER_PRINT             = 0x00000000,
     186                SPOOLSS_DM_NUP_BORDER_NONE              = 0x00000001
     187        } spoolss_DM_NupBorderFlags;
     188
     189        typedef [v1_enum] enum {
     190                SPOOLSS_DM_BOOKLET_LEFT_FLIP            = 0x00000000,
     191                SPOOLSS_DM_BOOKLET_RIGHT_FLIP           = 0x00000001
     192        } spoolss_DM_BookletFlags;
     193
     194        /* Device Mode Extra Data: PostScript */
     195
     196        /* NT 3.51 */
     197
     198        typedef [bitmap32bit] bitmap {
     199                SPOOLSS_DM_PS_FLAGS_DRV_ERROR_HANDLER   = 0x00000002,
     200                SPOOLSS_DM_PS_FLAGS_PRINT_MIRROR        = 0x00000004,
     201                SPOOLSS_DM_PS_FLAGS_PRINT_NEGATIVE      = 0x00000010,
     202                SPOOLSS_DM_PS_FLAGS_COMPRESS_BITMAP     = 0x00000040,
     203                SPOOLSS_DM_PS_FLAGS_ROTATE_180          = 0x00000200,
     204                SPOOLSS_DM_PS_FLAGS_GDI_METAFILE_SPOOL  = 0x00002000
     205        } spoolss_DMPS_Flags;
     206
     207        typedef struct {
     208                [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature;
     209                spoolss_DMPS_Flags dwFlags;
     210                uint32 wchEPSFile[12];
     211                [value(24)] uint16 caSize;
     212                uint16 caFlags;
     213                uint16 caIlluminantIndex;
     214                uint16 caRedGamma;
     215                uint16 caGreenGamma;
     216                uint16 caBlueGamma;
     217                uint16 caReferenceBlack;
     218                uint16 caReferenceWhite;
     219                uint16 caContrast;
     220                uint16 caBrightness;
     221                uint16 caColorfulness;
     222                uint16 caRedGreenTint;
     223        } spoolss_PSDRVEXTRA351;
     224
     225        /* NT 4.0 */
     226
     227        typedef struct {
     228                [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature;
     229                spoolss_DMPS_Flags dwFlags;
     230                uint32 wchEPSFile[12];
     231                [value(24)] uint16 caSize;
     232                uint16 caFlags;
     233                uint16 caIlluminantIndex;
     234                uint16 caRedGamma;
     235                uint16 caGreenGamma;
     236                uint16 caBlueGamma;
     237                uint16 caReferenceBlack;
     238                uint16 caReferenceWhite;
     239                uint16 caContrast;
     240                uint16 caBrightness;
     241                uint16 caColorfulness;
     242                uint16 caRedGreenTint;
     243                uint16 wChecksum;
     244                uint16 wOptions;
     245                uint32 aubOptions[8];
     246        } spoolss_PSDRVEXTRA400;
     247
     248        /* 2000 & XP */
     249
     250        typedef [v1_enum] enum {
     251                SPOOLSS_DM_PS_OPTIMIZE_SPEED            = 0x00000000,
     252                SPOOLSS_DM_PS_OPTIMIZE_PORTABILITY      = 0x00000001,
     253                SPOOLSS_DM_PS_OPTIMIZE_EPS              = 0x00000002,
     254                SPOOLSS_DM_PS_OPTIMIZE_ARCHIVAL         = 0x00000003
     255        } spoolss_DMPS_Dialect;
     256
     257        typedef [v1_enum] enum {
     258                SPOOLSS_DM_PS_TTDLFMT_DEFAULT           = 0x00000000,
     259                SPOOLSS_DM_PS_TTDLFMT_TYPE_1            = 0x00000001,
     260                SPOOLSS_DM_PS_TTDLFMT_TYPE_3            = 0x00000002,
     261                SPOOLSS_DM_PS_TTDLFMT_TYPE_42           = 0x00000003
     262        } spoolss_DMPS_TTDLFmt;
     263
     264        typedef [v1_enum] enum {
     265                SPOOLSS_DM_PS_PSLEVEL_1 = 0x00000001,
     266                SPOOLSS_DM_PS_PSLEVEL_2 = 0x00000002,
     267                SPOOLSS_DM_PS_PSLEVEL_3 = 0x00000003
     268        } spoolss_DMPS_PSLevel;
     269
     270        typedef enum {
     271                SPOOLSS_DM_PS_FEED_DIRECTION_LONG_EDGE_FIRST            = 0x0000,
     272                SPOOLSS_DM_PS_FEED_DIRECTION_SHORT_EDGE_FIRST           = 0x0001,
     273                SPOOLSS_DM_PS_FEED_DIRECTION_LONG_EDGE_FIRST_UPSIDEDOWN = 0x0002,
     274                SPOOLSS_DM_PS_FEED_DIRECTION_SHORT_EDGE_FIRST_UPSIDEDOWN= 0x0003
     275        } spoolss_DMPS_FeedDirection;
     276
     277        typedef struct {
     278                [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature;
     279                spoolss_DMPS_Flags dwFlags;
     280                uint32 wchEPSFile[12];
     281                [value(24)] uint16 caSize;
     282                uint16 caFlags;
     283                uint16 caIlluminantIndex;
     284                uint16 caRedGamma;
     285                uint16 caGreenGamma;
     286                uint16 caBlueGamma;
     287                uint16 caReferenceBlack;
     288                uint16 caReferenceWhite;
     289                uint16 caContrast;
     290                uint16 caBrightness;
     291                uint16 caColorfulness;
     292                uint16 caRedGreenTint;
     293                uint16 wReserved1;
     294                uint16 wSize;
     295                uint32 fxScrFreq;
     296                uint32 fxScrAngle;
     297                spoolss_DMPS_Dialect iDialect;
     298                spoolss_DMPS_TTDLFmt iTTDLFmt;
     299                boolean32 bReversePrint;
     300                spoolss_DM_Layout iLayout;
     301                spoolss_DMPS_PSLevel iPSLevel;
     302                uint32 dwReserved2;
     303                uint16 wOEMExtra;
     304                [value(0x0010)] uint16 wVer;
     305                uint32 dwX;
     306                uint32 dwY;
     307                uint32 dwWidthOffset;
     308                uint32 dwHeightOffset;
     309                spoolss_DMPS_FeedDirection wFeedDirection;
     310                uint16 wCutSheet;
     311                uint32 dwReserved3[4];
     312                uint32 dwChecksum32;
     313                uint32 dwOptions;
     314                uint32 aOptions[128];
     315        } spoolss_PSDRVEXTRA500;
     316
     317        /* Vista, 2008, 7 */
     318
     319        typedef struct {
     320                [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature;
     321                spoolss_DMPS_Flags dwFlags;
     322                uint32 wchEPSFile[12];
     323                [value(24)] uint16 caSize;
     324                uint16 caFlags;
     325                uint16 caIlluminantIndex;
     326                uint16 caRedGamma;
     327                uint16 caGreenGamma;
     328                uint16 caBlueGamma;
     329                uint16 caReferenceBlack;
     330                uint16 caReferenceWhite;
     331                uint16 caContrast;
     332                uint16 caBrightness;
     333                uint16 caColorfulness;
     334                uint16 caRedGreenTint;
     335                uint16 wCoreJTExpSize;
     336                [value(ndr_size_spoolss_PSDRVEXTRA(r, ndr->flags) + wCoreJTExpSize)] uint16 wCoreFullSize;
     337                uint32 fxScrFreq;
     338                uint32 fxScrAngle;
     339                spoolss_DMPS_Dialect iDialect;
     340                spoolss_DMPS_TTDLFmt iTTDLFmt;
     341                boolean32 bReversePrint;
     342                spoolss_DM_Layout iLayout;
     343                spoolss_DMPS_PSLevel iPSLevel;
     344                uint32 dwReserved2;
     345                uint16 wOEMExtra;
     346                [value(0x0010)] uint16 wVer;
     347                uint32 dwX;
     348                uint32 dwY;
     349                uint32 dwWidthOffset;
     350                uint32 dwHeightOffset;
     351                spoolss_DMPS_FeedDirection wFeedDirection;
     352                uint16 wCutSheet;
     353                uint32 dwReserved3[4];
     354                uint32 dwChecksum32;
     355                uint32 dwOptions;
     356                uint32 aOptions[128];
     357                spoolss_DM_NupDirection dwNupDirection;
     358                spoolss_DM_NupBorderFlags dwNupBorderFlags;
     359                spoolss_DM_BookletFlags dwBookletFlags;
     360                uint32 dwPadding;
     361        } spoolss_PSDRVEXTRA;
     362
     363        /* Device Mode Extra Data: UniDriver */
     364
     365        /* NT 3.5, NT 4.0 */
     366
     367        typedef struct {
     368                uint16 wReserved[56];
     369        } spoolss_UNIDRVEXTRA3_4;
     370
     371        /* 2000, XP */
     372
     373        typedef [v1_enum] enum {
     374                SPOOLSS_DM_UNI_QUALITY_BEST             = 0x00000000,
     375                SPOOLSS_DM_UNI_QUALITY_MEDIUM           = 0x00000001,
     376                SPOOLSS_DM_UNI_QUALITY_DRAFT            = 0x00000002
     377        } spoolss_DMUNI_Quality;
     378
     379        typedef [bitmap32bit] bitmap {
     380                SPOOLSS_DM_UNI_FLAGS_PRINT_TEXT_AS_GRAPHICS     = 0x00000002,
     381                SPOOLSS_DM_UNI_FLAGS_AVOID_EMFSPOOL             = 0x00000010,
     382                SPOOLSS_DM_UNI_FLAGS_CUSTOM_HALFTONING          = 0x00000080
     383        } spoolss_DMUNI_Flags;
     384
     385        typedef struct {
     386                [value(SPOOLSS_DM_SIGNATURE_UNIDRVEXTRA)] spoolss_DM_Signature dwSignature;
     387                [value(0x0022)] uint16 wVer;
     388                uint16 sPadding;
     389                uint16 wSize;
     390                uint16 wOEMExtra;
     391                uint32 dwChecksum32;
     392                spoolss_DMUNI_Flags dwFlags;
     393                boolean32 bReversePrint;
     394                spoolss_DM_Layout iLayout;
     395                spoolss_DMUNI_Quality iQuality;
     396                uint16 wReserved[6];
     397                uint32 dwOptions;
     398                uint32 aOptions[128];
     399        } spoolss_UNIDRVEXTRA500;
     400
     401        /* Vista, 2008, 7 */
     402
     403        typedef [public,gensize] struct {
     404                [value(SPOOLSS_DM_SIGNATURE_UNIDRVEXTRA)] spoolss_DM_Signature dwSignature;
     405                [value(0x0022)] uint16 wVer;
     406                uint16 wCoreJTExpSize;
     407                [value(ndr_size_spoolss_UNIDRVEXTRA(r, ndr->flags) + wCoreJTExpSize)] uint16 wCoreFullSize;
     408                uint16 wOEMExtra;
     409                uint32 dwChecksum32;
     410                spoolss_DMUNI_Flags dwFlags;
     411                boolean32 bReversePrint;
     412                spoolss_DM_Layout iLayout;
     413                spoolss_DMUNI_Quality iQuality;
     414                uint16 wReserved[6];
     415                uint32 dwOptions;
     416                uint32 aOptions[128];
     417                spoolss_DM_NupDirection dwNupDirection;
     418                spoolss_DM_NupBorderFlags dwNupBorderFlags;
     419                spoolss_DM_BookletFlags dwBookletFlags;
     420        } spoolss_UNIDRVEXTRA;
     421
     422        /* Device Mode Extra Data: JTEXP */
     423
     424        typedef struct {
     425                uint32 dwSize;
     426                [value(SPOOLSS_DM_SIGNATURE_JTEXP)] spoolss_DM_Signature dwSignature;
     427                [value(0)] uint32 dwVersion;
     428                [value(16)] uint32 wJTHdrSize;
     429                uint32 wCoreMFOSize;
     430                [string,charset(UTF16)] uint16 *ModelName;
     431                nstring_array FeatureOptionPairs;
     432        } spoolss_JTEXP;
     433
     434        /* Device Mode Extra Data: OEM_DMEXTRA */
     435
     436        typedef struct {
     437                uint32 dwSize;
     438                spoolss_DM_Signature dwSignature;
     439                uint32 dwVersion;
     440                [flag(NDR_REMAINING)] DATA_BLOB Data;
     441        } spoolss_OEM_DMEXTRA;
     442
     443        typedef [nodiscriminant] union {
     444                [case(0x0350)] spoolss_PSDRVEXTRA351    psdrvextra351;
     445                [case(0x0400)] spoolss_PSDRVEXTRA400    psdrvextra400;
     446                [case(0x0501)] spoolss_PSDRVEXTRA500    psdrvextra500;
     447                [case(0x0600)] spoolss_PSDRVEXTRA       psdrvextra;
     448                [default] [flag(NDR_REMAINING)] DATA_BLOB psblob;
     449        } spoolss_DeviceModeExtraDataPostScript;
     450
     451        typedef [nodiscriminant] union {
     452                [case(0x0301)] spoolss_UNIDRVEXTRA3_4   unidrvextra3_4;
     453                [case(0x0500)] spoolss_UNIDRVEXTRA500   unidrvextra500;
     454                [case(0x0600)] spoolss_UNIDRVEXTRA      unidrvextra;
     455                [default] [flag(NDR_REMAINING)] DATA_BLOB uniblob;
     456        } spoolss_DeviceModeExtraDataUniDriver;
    153457
    154458        typedef [bitmap32bit] bitmap {
     
    463767
    464768        typedef [public,gensize] struct {
    465                 spoolss_PrinterAttributes flags;
     769                spoolss_EnumPrinterFlags flags;
    466770                [relative] nstring *description;
    467771                [relative] nstring *name;
     
    581885        /* Function: 0x01 */
    582886        typedef struct {
    583                 [value(_ndr_size_spoolss_DeviceMode(devmode, ndr->iconv_convenience, ndr->flags))] uint32 _ndr_size;
     887                [value(_ndr_size_spoolss_DeviceMode(devmode, ndr->flags))] uint32 _ndr_size;
    584888                [subcontext(4),subcontext_size(_ndr_size)] spoolss_DeviceMode *devmode;
    585889        } spoolss_DevmodeContainer;
     
    8581162                uint32 total_pages;
    8591163                uint32 version;
    860                 uint32 free_build;
     1164                spoolss_Build free_build;
    8611165                uint32 spooling;
    8621166                uint32 max_spooling;
     
    8641168                uint32 num_error_out_of_paper;
    8651169                uint32 num_error_not_ready;
    866                 uint32 job_error;
     1170                spoolss_JobStatus job_error;
    8671171                uint32 number_of_processors;
    8681172                spoolss_ProcessorType processor_type;
     
    8701174                uint32 change_id;
    8711175                WERROR last_error;
    872                 uint32 status;
     1176                spoolss_PrinterStatus status;
    8731177                uint32 enumerate_network_printers;
    8741178                uint32 c_setprinter;
     
    9881292
    9891293        typedef [public] struct {
    990                 [value((ndr_size_spoolss_StringArray(r, ndr->iconv_convenience, ndr->flags)-4)/2)] uint32 _ndr_size;
     1294                [value((ndr_size_spoolss_StringArray(r, ndr->flags)-4)/2)] uint32 _ndr_size;
    9911295                /*[subcontext(0),subcontext_size(_ndr_size*2)]*/ nstring_array string;
    9921296        } spoolss_StringArray;
     
    10221326                [string,charset(UTF16)] uint16 *monitor_name;
    10231327                [string,charset(UTF16)] uint16 *default_datatype;
    1024                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
     1328                [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
    10251329                spoolss_StringArray *dependent_files;
    10261330        } spoolss_AddDriverInfo3;
     
    10361340                [string,charset(UTF16)] uint16 *monitor_name;
    10371341                [string,charset(UTF16)] uint16 *default_datatype;
    1038                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
     1342                [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
    10391343                spoolss_StringArray *dependent_files;
    1040                 [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
     1344                [value(((ndr_size_spoolss_StringArray(previous_names, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
    10411345                spoolss_StringArray *previous_names;
    10421346        } spoolss_AddDriverInfo4;
     
    10681372                [string,charset(UTF16)] uint16 *monitor_name;
    10691373                [string,charset(UTF16)] uint16 *default_datatype;
    1070                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
     1374                [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
    10711375                spoolss_StringArray *dependent_files;
    1072                 [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
     1376                [value(((ndr_size_spoolss_StringArray(previous_names, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
    10731377                spoolss_StringArray *previous_names;
    10741378                NTTIME driver_date;
     
    10901394                [string,charset(UTF16)] uint16 *monitor_name;
    10911395                [string,charset(UTF16)] uint16 *default_datatype;
    1092                 [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
     1396                [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files;
    10931397                spoolss_StringArray *dependent_files;
    1094                 [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
     1398                [value(((ndr_size_spoolss_StringArray(previous_names, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
    10951399                spoolss_StringArray *previous_names;
    10961400                NTTIME driver_date;
     
    11021406                [string,charset(UTF16)] uint16 *print_processor;
    11031407                [string,charset(UTF16)] uint16 *vendor_setup;
    1104                 [value(((ndr_size_spoolss_StringArray(color_profiles, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_color_profiles;
     1408                [value(((ndr_size_spoolss_StringArray(color_profiles, ndr->flags)-4)/2))] uint32 _ndr_size_color_profiles;
    11051409                spoolss_StringArray *color_profiles;
    11061410                [string,charset(UTF16)] uint16 *inf_path;
    11071411                uint32 printer_driver_attributes;
    1108                 [value(((ndr_size_spoolss_StringArray(core_driver_dependencies, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_core_driver_dependencies;
     1412                [value(((ndr_size_spoolss_StringArray(core_driver_dependencies, ndr->flags)-4)/2))] uint32 _ndr_size_core_driver_dependencies;
    11091413                spoolss_StringArray *core_driver_dependencies;
    11101414                NTTIME min_inbox_driver_ver_date;
     
    15231827
    15241828        typedef [public,gensize] struct {
    1525                 [value(ndr_size_spoolss_OSVersion(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
     1829                [value(ndr_size_spoolss_OSVersion(r,ndr->flags))] uint32 _ndr_size;
    15261830                uint32 major;
    15271831                uint32 minor;
     
    15321836
    15331837        typedef [public,gensize] struct {
    1534                 [value(ndr_size_spoolss_OSVersionEx(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
     1838                [value(ndr_size_spoolss_OSVersionEx(r,ndr->flags))] uint32 _ndr_size;
    15351839                uint32 major;
    15361840                uint32 minor;
     
    16221926        const string SPOOL_REG_VERSIONNUMBER            = "versionNumber";
    16231927
    1624         WERROR spoolss_GetPrinterData(
     1928        [public] WERROR spoolss_GetPrinterData(
    16251929                [in,ref] policy_handle *handle,
    16261930                [in]     [string,charset(UTF16)] uint16 value_name[],
     
    19302234        /******************/
    19312235        /* Function: 0x25 */
     2236
     2237        typedef [public,gensize] struct {
     2238                [string,charset(UTF16)] uint16 *port_name;
     2239        } spoolss_SetPortInfo1;
     2240
     2241        typedef [public,gensize] struct {
     2242                [string,charset(UTF16)] uint16 *port_name;
     2243                [string,charset(UTF16)] uint16 *monitor_name;
     2244                [string,charset(UTF16)] uint16 *description;
     2245                spoolss_PortType port_type;
     2246                uint32 reserved;
     2247        } spoolss_SetPortInfo2;
     2248
     2249        typedef [public,gensize] struct {
     2250                spoolss_PortStatus status;
     2251                [string,charset(UTF16)] uint16 *status_string;
     2252                spoolss_PortSeverity severity;
     2253        } spoolss_SetPortInfo3;
     2254
     2255        typedef [public,gensize] struct {
     2256                [string,charset(UTF16)] uint16 *port_name;
     2257                DATA_BLOB monitor_data; /* relative ?? */
     2258        } spoolss_SetPortInfoFF;
     2259
     2260        typedef [switch_type(uint32)] union {
     2261                [case(1)] spoolss_SetPortInfo1 *info1;
     2262                [case(2)] spoolss_SetPortInfo2 *info2;
     2263                [case(3)] spoolss_SetPortInfo3 *info3;
     2264                [case(0xff)] spoolss_SetPortInfoFF *infoFF;
     2265        } spoolss_SetPortInfo;
     2266
     2267        typedef struct {
     2268                uint32 level;
     2269                [switch_is(level)] spoolss_SetPrinterInfo info;
     2270        } spoolss_SetPortInfoContainer;
     2271
    19322272        WERROR spoolss_AddPort(
    19332273               [in,unique] [string,charset(UTF16)] uint16 *server_name,
     
    19432283        /******************/
    19442284        /* Function: 0x27 */
    1945         [todo] WERROR spoolss_DeletePort(
     2285        WERROR spoolss_DeletePort(
     2286               [in,unique] [string,charset(UTF16)] uint16 *server_name,
     2287               [in] uint32 ptr,
     2288               [in,ref] [string,charset(UTF16)] uint16 *port_name
    19462289        );
    19472290
     
    20552398        /******************/
    20562399        /* Function: 0x35 */
    2057         WERROR spoolss_GetPrinterDriver2(
     2400        [public] WERROR spoolss_GetPrinterDriver2(
    20582401                [in,ref] policy_handle *handle,
    20592402                [in,unique] [string,charset(UTF16)] uint16 *architecture,
     
    21672510        /******************/
    21682511        /* Function: 0x3d */
    2169         [todo] WERROR spoolss_AddPortEx(
     2512
     2513        typedef struct {
     2514                uint32 monitor_data_size;
     2515                [size_is(monitor_data_size),unique] uint8 *monitor_data;
     2516        } spoolss_PortVarContainer;
     2517
     2518        WERROR spoolss_AddPortEx(
     2519                [in,unique] [string,charset(UTF16)] uint16 *servername,
     2520                [in,ref] spoolss_SetPortInfoContainer *port_ctr,
     2521                [in,ref] spoolss_PortVarContainer *port_var_ctr,
     2522                [in,unique] [string,charset(UTF16)] uint16 *monitor_name
    21702523        );
    21712524
     
    24822835        /******************/
    24832836        /* Function: 0x47 */
    2484         [todo] WERROR spoolss_47(
     2837        WERROR spoolss_SetPort(
     2838                [in,unique] [string,charset(UTF16)] uint16 *servername,
     2839                [in,unique] [string,charset(UTF16)] uint16 *port_name,
     2840                [in,ref] spoolss_SetPortInfoContainer *port_ctr
    24852841        );
    24862842
     
    26312987        /******************/
    26322988        /* Function: 0x55 */
    2633         [todo] WERROR spoolss_55(
     2989        WERROR spoolss_AddPerMachineConnection(
     2990                [in,unique] [string,charset(UTF16)] uint16 *server,
     2991                [in,ref] [string,charset(UTF16)] uint16 *printername,
     2992                [in,ref] [string,charset(UTF16)] uint16 *printserver,
     2993                [in,ref] [string,charset(UTF16)] uint16 *provider
    26342994        );
    26352995
    26362996        /******************/
    26372997        /* Function: 0x56 */
    2638         [todo] WERROR spoolss_56(
     2998        WERROR spoolss_DeletePerMachineConnection(
     2999                [in,unique] [string,charset(UTF16)] uint16 *server,
     3000                [in,ref] [string,charset(UTF16)] uint16 *printername
    26393001        );
    26403002
    26413003        /******************/
    26423004        /* Function: 0x57 */
    2643         [todo] WERROR spoolss_57(
     3005        [todo] WERROR spoolss_EnumPerMachineConnections(
    26443006        );
    26453007
  • trunk/server/librpc/idl/srvsvc.idl

    r414 r745  
    44  srvsvc interface definitions
    55*/
    6 import "security.idl", "svcctl.idl";
     6import "misc.idl", "security.idl", "svcctl.idl";
    77
    88[ uuid("4b324fc8-1670-01d3-1278-5a47bf6ee188"),
  • trunk/server/librpc/idl/winreg.idl

    r429 r745  
    113113        } winreg_SecBuf;
    114114
     115        const int REG_OPTION_NON_VOLATILE = 0x00000000;
     116
     117        typedef [bitmap32bit] bitmap {
     118                REG_OPTION_VOLATILE             = 0x00000001,
     119                REG_OPTION_CREATE_LINK          = 0x00000002,
     120                REG_OPTION_BACKUP_RESTORE       = 0x00000004,
     121                REG_OPTION_OPEN_LINK            = 0x00000008
     122        } winreg_KeyOptions;
     123
    115124        typedef [v1_enum] enum {
    116125                REG_ACTION_NONE         = 0, /* used by caller */
     
    123132                [in] winreg_String name,
    124133                [in] winreg_String keyclass,
    125                 [in] uint32 options,
     134                [in] winreg_KeyOptions options,
    126135                [in] winreg_AccessMask access_mask,
    127136                [in,unique] winreg_SecBuf *secdesc,
     
    180189                [in,out,ref]    winreg_ValNameBuf *name,
    181190                [in,out,unique] winreg_Type *type,
    182                 [in,out,unique,size_is(*size),length_is(*length)] uint8 *value,
     191                [in,out,unique,size_is(size ? *size : 0),length_is(length ? *length : 0),range(0,0x4000000)] uint8 *value,
    183192                [in,out,unique] uint32 *size,
    184193                [in,out,unique] uint32 *length
     
    231240                [in,ref] policy_handle *parent_handle,
    232241                [in] winreg_String keyname,
    233                 [in] uint32 unknown,
     242                [in] winreg_KeyOptions options,
    234243                [in] winreg_AccessMask access_mask,
    235244                [out,ref] policy_handle *handle
     
    264273        /******************/
    265274        /* Function: 0x12 */
    266         [todo] WERROR winreg_ReplaceKey(
     275        WERROR winreg_ReplaceKey(
     276                [in,ref] policy_handle *handle,
     277                [in,ref] winreg_String *subkey,
     278                [in,ref] winreg_String *new_file,
     279                [in,ref] winreg_String *old_file
    267280        );
    268281
    269282        /******************/
    270283        /* Function: 0x13 */
     284
     285        typedef [public,bitmap32bit] bitmap {
     286                REG_WHOLE_HIVE_VOLATILE         = 0x00000001,
     287                REG_REFRESH_HIVE                = 0x00000002,
     288                REG_NO_LAZY_FLUSH               = 0x00000004,
     289                REG_FORCE_RESTORE               = 0x00000008
     290        } winreg_RestoreKeyFlags;
     291
    271292        WERROR winreg_RestoreKey(
    272293                [in,ref] policy_handle *handle,
    273294                [in,ref] winreg_String *filename,
    274                 [in]     uint32 flags
     295                [in]     winreg_RestoreKeyFlags flags
    275296        );
    276297
     
    310331        /******************/
    311332        /* Function: 0x17 */
    312         [todo] WERROR winreg_UnLoadKey(
     333        WERROR winreg_UnLoadKey(
     334                [in,ref] policy_handle *handle,
     335                [in,ref] winreg_String *subkey
    313336        );
    314337
     
    357380
    358381        typedef struct {
    359                 winreg_String *name;
    360                 winreg_Type type;
    361                 uint32 offset;
    362                 uint32 length;
     382                winreg_ValNameBuf *ve_valuename;
     383                uint32 ve_valuelen;
     384                uint32 ve_valueptr;
     385                winreg_Type ve_type;
    363386        } QueryMultipleValue;
    364        
     387
    365388        /******************/
    366389        /* Function: 0x1d */
    367390        [public] WERROR winreg_QueryMultipleValues(
    368391                [in,ref] policy_handle *key_handle,
    369                 [in,out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values,
     392                [in,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_in,
     393                [out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_out,
    370394                [in] uint32 num_values,
    371395                [in,out,unique,size_is(*buffer_size),length_is(*buffer_size)] uint8 *buffer,
     
    390414        /******************/
    391415        /* Function: 0x1f */
    392         [todo] WERROR winreg_SaveKeyEx(
     416        WERROR winreg_SaveKeyEx(
     417                [in,ref] policy_handle *handle,
     418                [in,ref] winreg_String *filename,
     419                [in,unique] KeySecurityAttribute *sec_attrib,
     420                [in] uint32 flags
    393421        );
    394422
     
    411439        /******************/
    412440        /* Function: 0x22 */
    413         [todo] WERROR winreg_QueryMultipleValues2(
     441        [public] WERROR winreg_QueryMultipleValues2(
     442                [in,ref] policy_handle *key_handle,
     443                [in,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_in,
     444                [out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_out,
     445                [in] uint32 num_values,
     446                [in,out,unique,size_is(*offered),length_is(*offered)] uint8 *buffer,
     447                [in,ref] uint32 *offered,
     448                [out,ref] uint32 *needed
     449        );
     450
     451        /******************/
     452        /* Function: 0x23 */
     453        WERROR winreg_DeleteKeyEx(
     454                [in,ref] policy_handle *handle,
     455                [in,ref] winreg_String *key,
     456                [in] winreg_AccessMask access_mask,
     457                [in] uint32 reserved
    414458        );
    415459}
  • trunk/server/librpc/idl/wmi.idl

    r414 r745  
    99
    1010[
    11         helper("librpc/ndr/ndr_wmi.h"),
    1211        uuid("8BC3F05E-D86B-11d0-A075-00C04FB68820")
    1312] coclass WbemLevel1Login
     
    1817
    1918[
    20         local, 
    21         object, 
     19        local,
     20        object,
    2221        uuid("dc12a681-737f-11cf-884d-00aa004b2e24")
    2322]
     
    204203    }   WBEMSTATUS;
    205204
    206     typedef [public,noprint] enum
     205    typedef [public] bitmap
    207206    {
    208207        WBEM_FLAG_RETURN_WBEM_COMPLETE          = 0,
     
    226225    } WBEM_GENERIC_FLAG_TYPE;
    227226
    228     typedef [public,noprint,v1_enum] enum tag_WBEM_TIMEOUT_TYPE
     227    typedef [public,v1_enum] enum tag_WBEM_TIMEOUT_TYPE
    229228    {
    230229        WBEM_NO_WAIT = 0,
     
    280279        WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE = 0x1,
    281280        WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS = 0x2,
    282 //        WBEM_FLAVOR_MASK_PROPAGATION = 0x0F,
     281/*        WBEM_FLAVOR_MASK_PROPAGATION = 0x0F, */
    283282
    284283        WBEM_FLAVOR_NOT_OVERRIDABLE = 0x10,
    285 //        WBEM_FLAVOR_MASK_PERMISSIONS = 0x10,
     284/*        WBEM_FLAVOR_MASK_PERMISSIONS = 0x10, */
    286285
    287286        WBEM_FLAVOR_ORIGIN_PROPAGATED = 0x20,
    288287        WBEM_FLAVOR_ORIGIN_SYSTEM = 0x40,
    289 //        WBEM_FLAVOR_MASK_ORIGIN = 0x60,
     288/*        WBEM_FLAVOR_MASK_ORIGIN = 0x60, */
    290289
    291290        WBEM_FLAVOR_AMENDED = 0x80
    292 //        WBEM_FLAVOR_MASK_AMENDED = 0x80
     291/*        WBEM_FLAVOR_MASK_AMENDED = 0x80 */
    293292
    294293    } WBEM_FLAVOR_TYPE;
     
    300299                WCF_CLASS = 4,
    301300                WCF_CLASS_PART_INTERNAL = 8
    302         //      WCF_CLASS_PART_SHARED = 0x104
    303     } WCO_FLAGS;
    304 
    305     typedef [public,nopull,nopush] struct
    306     {
     301        /*      WCF_CLASS_PART_SHARED = 0x104 */
     302        } WCO_FLAGS;
     303
     304        typedef struct
     305        {
    307306                uint32 count;
    308307                [ref,charset(UTF16)] uint16 *item[count];
    309     } CIMSTRINGS;
    310 
    311     typedef [public,bitmap8bit] bitmap {
    312         DEFAULT_FLAG_EMPTY = 1,
    313         DEFAULT_FLAG_INHERITED = 2
    314     } DEFAULT_FLAGS;
     308        } CIMSTRINGS;
     309
     310        typedef [public,bitmap8bit] bitmap {
     311                DEFAULT_FLAG_EMPTY = 1,
     312                DEFAULT_FLAG_INHERITED = 2
     313        } DEFAULT_FLAGS;
    315314
    316315        WERROR OpenNamespace(
     
    421420
    422421    WERROR CreateInstanceEnum(
    423         [in] BSTR strFilter,          // allow more things than a class name
     422        [in] BSTR strFilter,          /* allow more things than a class name */
    424423        [in] long lFlags,
    425424        [in,unique]  IWbemContext* pCtx,
     
    526525
    527526    WERROR GetNames(
    528 //        [in] long lFlags,
    529 //        [out] SAFEARRAY (BSTR)* pNames
     527/*        [in] long lFlags, */
     528/*        [out] SAFEARRAY (BSTR)* pNames */
    530529        );
    531530
     
    533532
    534533    WERROR Next(
    535 //        [in]  long lFlags,
    536 //        [out] BSTR* pstrName,
    537 //        [out] VARIANT* pValue
     534/*        [in]  long lFlags, */
     535/*        [out] BSTR* pstrName, */
     536/*        [out] VARIANT* pValue */
    538537        );
    539538
     
    542541
    543542    WERROR SetValue(
    544 //        [in, string] LPCWSTR wszName,
    545 //        [in] long lFlags
    546 //        [in] VARIANT* pValue
     543/*        [in, string] LPCWSTR wszName, */
     544/*        [in] long lFlags */
     545/*        [in] VARIANT* pValue */
    547546        );
    548547
    549548    WERROR GetValue(
    550 //        [in, string] LPCWSTR wszName,
    551 //        [in] long lFlags,
    552 //        [out] VARIANT* pValue
     549/*        [in, string] LPCWSTR wszName, */
     550/*        [in] long lFlags, */
     551/*        [out] VARIANT* pValue */
    553552        );
    554553
    555554    WERROR DeleteValue(
    556 //        [in, string] LPCWSTR wszName,
    557 //        [in] long lFlags
     555/*        [in, string] LPCWSTR wszName, */
     556/*        [in] long lFlags */
    558557        );
    559558
     
    614613
    615614        typedef [relative_base] struct {
    616                 //      [relative] WBEMDATA4 *data; /* 0x9 */
     615                /*      [relative] WBEMDATA4 *data; */ /* 0x9 */
    617616                uint32 data_size;
    618617                uint8 wtype;
     
    654653                [out,ref] uint32 *puReturned,
    655654                [out,ref] uint32 *pSize,
    656                 [out,ref,noprint,size_is(,*pSize)] uint8 **pData
     655                [out,ref,size_is(,*pSize)] uint8 **pData
    657656                );
    658657}
     
    670669[
    671670        object,
    672         //      restricted,
     671        /*      restricted, */
    673672        uuid(44aca675-e8fc-11d0-a07c-00c04fb68820)
    674673] interface IWbemCallResult : IUnknown
  • trunk/server/librpc/idl/xattr.idl

    r414 r745  
    1515  version(0.0),
    1616  helper("../librpc/ndr/ndr_xattr.h"),
     17  pyhelper("librpc/ndr/py_xattr.c"),
    1718  pointer_default(unique)
    1819]
  • trunk/server/librpc/ndr.pc.in

    r414 r745  
    88Requires: samba-hostconfig talloc
    99Version: 0.0.1
    10 Libs: -L${libdir} -lndr
     10Libs: @LIB_RPATH@ -L${libdir} -lndr
    1111Cflags: -I${includedir}  -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1
  • trunk/server/librpc/ndr/libndr.h

    r590 r745  
    6161        uint32_t offset;
    6262
    63         struct smb_iconv_convenience *iconv_convenience;
    64 
     63        uint32_t relative_highest_offset;
    6564        uint32_t relative_base_offset;
     65        uint32_t relative_rap_convert;
    6666        struct ndr_token_list *relative_base_list;
    6767
     
    9393        struct ndr_token_list *relative_begin_list;
    9494        struct ndr_token_list *nbt_string_list;
     95        struct ndr_token_list *dns_string_list;
    9596        struct ndr_token_list *full_ptr_list;
    9697
    9798        /* this is used to ensure we generate unique reference IDs */
    9899        uint32_t ptr_count;
    99 
    100         struct smb_iconv_convenience *iconv_convenience;
    101100};
    102101
     
    106105        uint32_t depth;
    107106        struct ndr_token_list *switch_list;
    108         struct smb_iconv_convenience *iconv_convenience;
    109107        void (*print)(struct ndr_print *, const char *, ...) PRINTF_ATTRIBUTE(2,3);
    110108        void *private_data;
     109        bool no_newline;
    111110};
    112111
     
    192191        NDR_ERR_TOKEN,
    193192        NDR_ERR_IPV4ADDRESS,
     193        NDR_ERR_IPV6ADDRESS,
    194194        NDR_ERR_INVALID_POINTER,
    195195        NDR_ERR_UNREAD_BYTES,
     
    329329extern const struct ndr_syntax_id ndr_transfer_syntax;
    330330extern const struct ndr_syntax_id ndr64_transfer_syntax;
     331extern const struct ndr_syntax_id null_ndr_syntax_id;
     332
     333struct ndr_interface_call_pipe {
     334        const char *name;
     335        const char *chunk_struct_name;
     336        size_t chunk_struct_size;
     337        ndr_push_flags_fn_t ndr_push;
     338        ndr_pull_flags_fn_t ndr_pull;
     339        ndr_print_fn_t ndr_print;
     340};
     341
     342struct ndr_interface_call_pipes {
     343        uint32_t num_pipes;
     344        const struct ndr_interface_call_pipe *pipes;
     345};
    331346
    332347struct ndr_interface_call {
     
    336351        ndr_pull_flags_fn_t ndr_pull;
    337352        ndr_print_function_t ndr_print;
    338         bool async;
     353        struct ndr_interface_call_pipes in_pipes;
     354        struct ndr_interface_call_pipes out_pipes;
    339355};
    340356
     
    364380NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err);
    365381const char *ndr_map_error2string(enum ndr_err_code ndr_err);
     382#define ndr_errstr ndr_map_error2string
    366383
    367384/* FIXME: Use represent_as instead */
     
    378395void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
    379396size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags);
    380 void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct in_addr *_ip);
    381397void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
    382398bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, const struct ndr_syntax_id *i2);
    383 enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const void *p, ndr_push_flags_fn_t fn);
    384 enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p, uint32_t level, ndr_push_flags_fn_t fn);
    385 size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push, struct smb_iconv_convenience *);
    386 size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push, struct smb_iconv_convenience *);
     399enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn);
     400enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_push_flags_fn_t fn);
     401size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push);
     402size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push);
    387403uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr);
    388404void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset);
     
    390406enum ndr_err_code ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p);
    391407enum ndr_err_code ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p);
     408enum ndr_err_code ndr_push_short_relative_ptr1(struct ndr_push *ndr, const void *p);
    392409enum ndr_err_code ndr_push_relative_ptr2_start(struct ndr_push *ndr, const void *p);
    393410enum ndr_err_code ndr_push_relative_ptr2_end(struct ndr_push *ndr, const void *p);
     411enum ndr_err_code ndr_push_short_relative_ptr2(struct ndr_push *ndr, const void *p);
    394412uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr);
    395413void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset);
     
    398416enum ndr_err_code ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset);
    399417enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p);
     418enum ndr_err_code ndr_pull_relative_ptr_short(struct ndr_pull *ndr, uint16_t *v);
    400419size_t ndr_align_size(uint32_t offset, size_t n);
    401 struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience);
     420struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
    402421enum ndr_err_code ndr_pull_advance(struct ndr_pull *ndr, uint32_t size);
    403 struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience);
     422struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx);
    404423DATA_BLOB ndr_push_blob(struct ndr_push *ndr);
    405424enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size);
    406425void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
     426void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
    407427void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
    408428void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr);
     
    441461                         const void *key,
    442462                         uint32_t value);
    443 enum ndr_err_code ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v, comparison_fn_t _cmp_fn, bool _remove_tok);
     463enum ndr_err_code ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v, int(*_cmp_fn)(const void*,const void*), bool _remove_tok);
    444464enum ndr_err_code ndr_token_retrieve(struct ndr_token_list **list, const void *key, uint32_t *v);
    445465uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key);
     
    450470uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p);
    451471enum ndr_err_code ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length);
     472enum ndr_err_code ndr_push_pipe_chunk_trailer(struct ndr_push *ndr, int ndr_flags, uint32_t count);
     473enum ndr_err_code ndr_check_pipe_chunk_trailer(struct ndr_pull *ndr, int ndr_flags, uint32_t count);
    452474enum ndr_err_code ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val);
    453475enum ndr_err_code ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val);
     
    456478uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p);
    457479uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p);
    458 enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p, ndr_pull_flags_fn_t fn);
    459 enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p, ndr_pull_flags_fn_t fn);
    460 enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p, uint32_t level, ndr_pull_flags_fn_t fn);
    461 enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p, uint32_t level, ndr_pull_flags_fn_t fn);
     480enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, ndr_pull_flags_fn_t fn);
     481enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, ndr_pull_flags_fn_t fn);
     482enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_pull_flags_fn_t fn);
     483enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_pull_flags_fn_t fn);
    462484
    463485/* from libndr_basic.h */
     
    487509NDR_SCALAR_PROTO(pointer, void *)
    488510NDR_SCALAR_PROTO(time_t, time_t)
     511NDR_SCALAR_PROTO(uid_t, uid_t)
     512NDR_SCALAR_PROTO(gid_t, gid_t)
    489513NDR_SCALAR_PROTO(NTSTATUS, NTSTATUS)
    490514NDR_SCALAR_PROTO(WERROR, WERROR)
     
    494518NDR_SCALAR_PROTO(DATA_BLOB, DATA_BLOB)
    495519NDR_SCALAR_PROTO(ipv4address, const char *)
     520NDR_SCALAR_PROTO(ipv6address, const char *)
    496521NDR_SCALAR_PROTO(string, const char *)
    497522NDR_SCALAR_PROTO(double, double)
     
    500525enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r);
    501526void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r);
    502 bool policy_handle_empty(struct policy_handle *h);
     527bool policy_handle_empty(const struct policy_handle *h);
     528bool is_valid_policy_hnd(const struct policy_handle *hnd);
     529bool policy_handle_equal(const struct policy_handle *hnd1,
     530                         const struct policy_handle *hnd2);
    503531
    504532void ndr_check_padding(struct ndr_pull *ndr, size_t n);
     
    520548enum ndr_err_code ndr_push_ref_ptr(struct ndr_push *ndr);
    521549void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type);
     550void ndr_print_null(struct ndr_print *ndr);
    522551void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type, const char *val, uint32_t value);
    523552void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value);
     
    544573/* GUIDs */
    545574bool GUID_equal(const struct GUID *u1, const struct GUID *u2);
     575NTSTATUS GUID_to_ndr_blob(const struct GUID *guid, TALLOC_CTX *mem_ctx, DATA_BLOB *b);
    546576NTSTATUS GUID_from_ndr_blob(const DATA_BLOB *b, struct GUID *guid);
    547577NTSTATUS GUID_from_data_blob(const DATA_BLOB *s, struct GUID *guid);
     
    566596_PUBLIC_ enum ndr_err_code ndr_push_enum_uint1632(struct ndr_push *ndr, int ndr_flags, uint16_t v);
    567597
     598_PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
     599
    568600#endif /* __LIBNDR_H__ */
  • trunk/server/librpc/ndr/ndr.c

    r596 r745  
    4747};
    4848
     49const struct ndr_syntax_id null_ndr_syntax_id = {
     50  { 0, 0, 0, { 0, 0 }, { 0, 0, 0, 0, 0, 0 } },
     51  0
     52};
     53
    4954/*
    5055  work out the number of bytes needed to align on a n byte boundary
     
    5964  initialise a ndr parse structure from a data blob
    6065*/
    61 _PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience)
     66_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
    6267{
    6368        struct ndr_pull *ndr;
     
    6974        ndr->data = blob->data;
    7075        ndr->data_size = blob->length;
    71         ndr->iconv_convenience = talloc_reference(ndr, iconv_convenience);
    7276
    7377        return ndr;
     
    103107
    104108/* create a ndr_push structure, ready for some marshalling */
    105 _PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience)
     109_PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx)
    106110{
    107111        struct ndr_push *ndr;
     
    118122                return NULL;
    119123        }
    120         ndr->iconv_convenience = talloc_reference(ndr, iconv_convenience);
    121124
    122125        return ndr;
     
    169172        va_list ap;
    170173        char *s = NULL;
    171         int i, ret;
     174        uint32_t i;
     175        int ret;
    172176
    173177        va_start(ap, format);
     
    179183        }
    180184
     185        if (ndr->no_newline) {
     186                DEBUGADD(1,("%s", s));
     187                free(s);
     188                return;
     189        }
     190
    181191        for (i=0;i<ndr->depth;i++) {
    182192                DEBUGADD(1,("    "));
     
    187197}
    188198
     199_PUBLIC_ void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...)
     200{
     201        va_list ap;
     202        uint32_t i;
     203
     204        if (!ndr->no_newline) {
     205                for (i=0;i<ndr->depth;i++) {
     206                        printf("    ");
     207                }
     208        }
     209
     210        va_start(ap, format);
     211        vprintf(format, ap);
     212        va_end(ap);
     213        if (!ndr->no_newline) {
     214                printf("\n");
     215        }
     216}
     217
    189218_PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...)
    190219{
    191220        va_list ap;
    192         int i;
    193 
    194         for (i=0;i<ndr->depth;i++) {
    195                 ndr->private_data = talloc_asprintf_append_buffer(
    196                                         (char *)ndr->private_data, "    ");
     221        uint32_t i;
     222
     223        if (!ndr->no_newline) {
     224                for (i=0;i<ndr->depth;i++) {
     225                        ndr->private_data = talloc_asprintf_append_buffer(
     226                                (char *)ndr->private_data, "    ");
     227                }
    197228        }
    198229
     
    201232                                                    format, ap);
    202233        va_end(ap);
    203         ndr->private_data = talloc_asprintf_append_buffer((char *)ndr->private_data,
    204                                                    "\n");
     234        if (!ndr->no_newline) {
     235                ndr->private_data = talloc_asprintf_append_buffer((char *)ndr->private_data,
     236                                                                  "\n");
     237        }
    205238}
    206239
     
    257290        ndr->flags = 0;
    258291
    259         /* this is a s4 hack until we build up the courage to pass
    260          * this all the way down
    261          */
    262 #if _SAMBA_BUILD_ == 4
    263         ndr->iconv_convenience = smb_iconv_convenience_init(talloc_autofree_context(), "ASCII", "UTF-8", true);
    264 #endif
    265 
    266292        fn(ndr, name, flags, ptr);
    267293        talloc_free(ndr);
     
    285311        ndr->depth = 1;
    286312        ndr->flags = 0;
    287 
    288         /* this is a s4 hack until we build up the courage to pass
    289          * this all the way down
    290          */
    291 #if _SAMBA_BUILD_ == 4
    292         ndr->iconv_convenience = smb_iconv_convenience_init(talloc_autofree_context(), "ASCII", "UTF-8", true);
    293 #endif
    294313
    295314        fn(ndr, name, ptr);
     
    554573        subndr->offset = 0;
    555574        subndr->data_size = r_content_size;
    556         subndr->iconv_convenience = talloc_reference(subndr, ndr->iconv_convenience);
    557575
    558576        if (force_le) {
     
    590608        struct ndr_push *subndr;
    591609
    592         subndr = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
     610        subndr = ndr_push_init_ctx(ndr);
    593611        NDR_ERR_HAVE_NO_MEMORY(subndr);
    594612        subndr->flags   = ndr->flags & ~LIBNDR_FLAG_NDR64;
     
    812830}
    813831
     832_PUBLIC_ enum ndr_err_code ndr_push_pipe_chunk_trailer(struct ndr_push *ndr, int ndr_flags, uint32_t count)
     833{
     834        if (ndr->flags & LIBNDR_FLAG_NDR64) {
     835                int64_t tmp = 0 - (int64_t)count;
     836                uint64_t ncount = tmp;
     837
     838                NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, ncount));
     839        }
     840
     841        return NDR_ERR_SUCCESS;
     842}
     843
     844_PUBLIC_ enum ndr_err_code ndr_check_pipe_chunk_trailer(struct ndr_pull *ndr, int ndr_flags, uint32_t count)
     845{
     846        if (ndr->flags & LIBNDR_FLAG_NDR64) {
     847                int64_t tmp = 0 - (int64_t)count;
     848                uint64_t ncount1 = tmp;
     849                uint64_t ncount2;
     850
     851                NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &ncount2));
     852                if (ncount1 == ncount2) {
     853                        return NDR_ERR_SUCCESS;
     854                }
     855
     856                return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
     857                        "Bad pipe trailer[%lld should be %lld] size was %lu\"",
     858                        (unsigned long long)ncount2,
     859                        (unsigned long long)ncount1,
     860                        (unsigned long)count);
     861        }
     862
     863        return NDR_ERR_SUCCESS;
     864}
     865
    814866/*
    815867  store a switch value
     
    851903  pull a struct from a blob using NDR
    852904*/
    853 _PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p,
     905_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
    854906                              ndr_pull_flags_fn_t fn)
    855907{
    856908        struct ndr_pull *ndr;
    857         ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience);
     909        ndr = ndr_pull_init_blob(blob, mem_ctx);
    858910        NDR_ERR_HAVE_NO_MEMORY(ndr);
    859911        NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
     
    866918*/
    867919_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
    868                                                     struct smb_iconv_convenience *iconv_convenience,
    869920                                                    void *p, ndr_pull_flags_fn_t fn)
    870921{
    871922        struct ndr_pull *ndr;
    872         ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience);
     923        uint32_t highest_ofs;
     924        ndr = ndr_pull_init_blob(blob, mem_ctx);
    873925        NDR_ERR_HAVE_NO_MEMORY(ndr);
    874926        NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
    875         if (ndr->offset < ndr->data_size) {
    876                 return ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
    877                                       "not all bytes consumed ofs[%u] size[%u]",
    878                                       ndr->offset, ndr->data_size);
     927        if (ndr->offset > ndr->relative_highest_offset) {
     928                highest_ofs = ndr->offset;
     929        } else {
     930                highest_ofs = ndr->relative_highest_offset;
     931        }
     932        if (highest_ofs < ndr->data_size) {
     933                enum ndr_err_code ret;
     934                ret = ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
     935                                     "not all bytes consumed ofs[%u] size[%u]",
     936                                     highest_ofs, ndr->data_size);
     937                talloc_free(ndr);
     938                return ret;
    879939        }
    880940        talloc_free(ndr);
     
    886946*/
    887947_PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
    888                                                struct smb_iconv_convenience *iconv_convenience, void *p,
     948                                               void *p,
    889949                             uint32_t level, ndr_pull_flags_fn_t fn)
    890950{
    891951        struct ndr_pull *ndr;
    892         ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience);
     952        ndr = ndr_pull_init_blob(blob, mem_ctx);
    893953        NDR_ERR_HAVE_NO_MEMORY(ndr);
    894954        NDR_CHECK_FREE(ndr_pull_set_switch_value(ndr, p, level));
     
    903963*/
    904964_PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
    905                                                    struct smb_iconv_convenience *iconv_convenience, void *p,
     965                                                   void *p,
    906966                             uint32_t level, ndr_pull_flags_fn_t fn)
    907967{
    908968        struct ndr_pull *ndr;
    909         ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience);
     969        uint32_t highest_ofs;
     970        ndr = ndr_pull_init_blob(blob, mem_ctx);
    910971        NDR_ERR_HAVE_NO_MEMORY(ndr);
    911972        NDR_CHECK_FREE(ndr_pull_set_switch_value(ndr, p, level));
    912973        NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
    913         if (ndr->offset < ndr->data_size) {
     974        if (ndr->offset > ndr->relative_highest_offset) {
     975                highest_ofs = ndr->offset;
     976        } else {
     977                highest_ofs = ndr->relative_highest_offset;
     978        }
     979        if (highest_ofs < ndr->data_size) {
    914980                enum ndr_err_code ret;
    915981                ret = ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
    916982                                     "not all bytes consumed ofs[%u] size[%u]",
    917                                      ndr->offset, ndr->data_size);
     983                                     highest_ofs, ndr->data_size);
    918984                talloc_free(ndr);
    919985                return ret;
     
    926992  push a struct to a blob using NDR
    927993*/
    928 _PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const void *p, ndr_push_flags_fn_t fn)
     994_PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn)
    929995{
    930996        struct ndr_push *ndr;
    931         ndr = ndr_push_init_ctx(mem_ctx, iconv_convenience);
     997        ndr = ndr_push_init_ctx(mem_ctx);
    932998        NDR_ERR_HAVE_NO_MEMORY(ndr);
    933999
     
    9441010  push a union to a blob using NDR
    9451011*/
    946 _PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p,
     1012_PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
    9471013                             uint32_t level, ndr_push_flags_fn_t fn)
    9481014{
    9491015        struct ndr_push *ndr;
    950         ndr = ndr_push_init_ctx(mem_ctx, iconv_convenience);
     1016        ndr = ndr_push_init_ctx(mem_ctx);
    9511017        NDR_ERR_HAVE_NO_MEMORY(ndr);
    9521018
     
    9641030  generic ndr_size_*() handler for structures
    9651031*/
    966 _PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push, struct smb_iconv_convenience *iconv_convenience)
     1032_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push)
    9671033{
    9681034        struct ndr_push *ndr;
     
    9731039        if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
    9741040
    975         ndr = ndr_push_init_ctx(NULL, iconv_convenience);
     1041        ndr = ndr_push_init_ctx(NULL);
    9761042        if (!ndr) return 0;
    9771043        ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
     
    9891055  generic ndr_size_*() handler for unions
    9901056*/
    991 _PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push, struct smb_iconv_convenience *iconv_convenience)
     1057_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push)
    9921058{
    9931059        struct ndr_push *ndr;
     
    9981064        if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
    9991065
    1000         ndr = ndr_push_init_ctx(NULL, iconv_convenience);
     1066        ndr = ndr_push_init_ctx(NULL);
    10011067        if (!ndr) return 0;
    10021068        ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
     
    10671133}
    10681134
     1135/*
     1136  push a short relative object - stage1
     1137  this is called during SCALARS processing
     1138*/
     1139_PUBLIC_ enum ndr_err_code ndr_push_short_relative_ptr1(struct ndr_push *ndr, const void *p)
     1140{
     1141        if (p == NULL) {
     1142                NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 0));
     1143                return NDR_ERR_SUCCESS;
     1144        }
     1145        NDR_CHECK(ndr_push_align(ndr, 2));
     1146        NDR_CHECK(ndr_token_store(ndr, &ndr->relative_list, p, ndr->offset));
     1147        return ndr_push_uint16(ndr, NDR_SCALARS, 0xFFFF);
     1148}
    10691149/*
    10701150  push a relative object - stage2
     
    10921172        }       
    10931173        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, save_offset - ndr->relative_base_offset));
     1174        ndr->offset = save_offset;
     1175        return NDR_ERR_SUCCESS;
     1176}
     1177/*
     1178  push a short relative object - stage2
     1179  this is called during buffers processing
     1180*/
     1181_PUBLIC_ enum ndr_err_code ndr_push_short_relative_ptr2(struct ndr_push *ndr, const void *p)
     1182{
     1183        uint32_t save_offset;
     1184        uint32_t ptr_offset = 0xFFFF;
     1185        if (p == NULL) {
     1186                return NDR_ERR_SUCCESS;
     1187        }
     1188        save_offset = ndr->offset;
     1189        NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &ptr_offset));
     1190        if (ptr_offset > ndr->offset) {
     1191                return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
     1192                                      "ndr_push_short_relative_ptr2 ptr_offset(%u) > ndr->offset(%u)",
     1193                                      ptr_offset, ndr->offset);
     1194        }
     1195        ndr->offset = ptr_offset;
     1196        if (save_offset < ndr->relative_base_offset) {
     1197                return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
     1198                                      "ndr_push_relative_ptr2 save_offset(%u) < ndr->relative_base_offset(%u)",
     1199                                      save_offset, ndr->relative_base_offset);
     1200        }
     1201        NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, save_offset - ndr->relative_base_offset));
    10941202        ndr->offset = save_offset;
    10951203        return NDR_ERR_SUCCESS;
  • trunk/server/librpc/ndr/ndr_basic.c

    r596 r745  
    2323#include "system/network.h"
    2424#include "librpc/ndr/libndr.h"
     25#include "lib/util/util_net.h"
    2526
    2627#define NDR_SVAL(ndr, ofs) (NDR_BE(ndr)?RSVAL(ndr->data,ofs):SVAL(ndr->data,ofs))
     
    177178
    178179/*
     180  parse a pointer referent identifier stored in 2 bytes
     181*/
     182_PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr_short(struct ndr_pull *ndr, uint16_t *v)
     183{
     184        NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, v));
     185        if (*v != 0) {
     186                ndr->ptr_count++;
     187        }
     188        *(v) -= ndr->relative_rap_convert;
     189        return NDR_ERR_SUCCESS;
     190}
     191
     192/*
    179193  parse a pointer referent identifier
    180194*/
     
    239253{
    240254        NDR_PULL_ALIGN(ndr, 8);
     255        if (NDR_BE(ndr)) {
     256                return ndr_pull_udlongr(ndr, ndr_flags, v);
     257        }
    241258        return ndr_pull_udlong(ndr, ndr_flags, v);
    242259}
     
    536553{
    537554        NDR_PUSH_ALIGN(ndr, 8);
     555        if (NDR_BE(ndr)) {
     556                return ndr_push_udlongr(ndr, NDR_SCALARS, v);
     557        }
    538558        return ndr_push_udlong(ndr, NDR_SCALARS, v);
    539559}
     
    791811
    792812/*
     813  push a uid_t
     814*/
     815_PUBLIC_ enum ndr_err_code ndr_push_uid_t(struct ndr_push *ndr, int ndr_flags, uid_t u)
     816{
     817        return ndr_push_hyper(ndr, NDR_SCALARS, (uint64_t)u);
     818}
     819
     820/*
     821  pull a uid_t
     822*/
     823_PUBLIC_ enum ndr_err_code ndr_pull_uid_t(struct ndr_pull *ndr, int ndr_flags, uid_t *u)
     824{
     825        uint64_t uu;
     826        NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &uu));
     827        *u = (uid_t)uu;
     828        if (unlikely(uu != *u)) {
     829                DEBUG(0,(__location__ ": uid_t pull doesn't fit 0x%016llx\n",
     830                         (unsigned long long)uu));
     831                return NDR_ERR_NDR64;
     832        }
     833        return NDR_ERR_SUCCESS;
     834}
     835
     836
     837/*
     838  push a gid_t
     839*/
     840_PUBLIC_ enum ndr_err_code ndr_push_gid_t(struct ndr_push *ndr, int ndr_flags, gid_t g)
     841{
     842        return ndr_push_hyper(ndr, NDR_SCALARS, (uint64_t)g);
     843}
     844
     845/*
     846  pull a gid_t
     847*/
     848_PUBLIC_ enum ndr_err_code ndr_pull_gid_t(struct ndr_pull *ndr, int ndr_flags, gid_t *g)
     849{
     850        uint64_t gg;
     851        NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &gg));
     852        *g = (gid_t)gg;
     853        if (unlikely(gg != *g)) {
     854                DEBUG(0,(__location__ ": gid_t pull doesn't fit 0x%016llx\n",
     855                         (unsigned long long)gg));
     856                return NDR_ERR_NDR64;
     857        }
     858        return NDR_ERR_SUCCESS;
     859}
     860
     861
     862/*
    793863  pull a ipv4address
    794864*/
     
    812882        if (!is_ipaddress(address)) {
    813883                return ndr_push_error(ndr, NDR_ERR_IPV4ADDRESS,
    814                                       "Invalid IPv4 address: '%s'", 
     884                                      "Invalid IPv4 address: '%s'",
    815885                                      address);
    816886        }
     
    823893  print a ipv4address
    824894*/
    825 _PUBLIC_ void ndr_print_ipv4address(struct ndr_print *ndr, const char *name, 
     895_PUBLIC_ void ndr_print_ipv4address(struct ndr_print *ndr, const char *name,
    826896                           const char *address)
    827897{
     
    829899}
    830900
     901/*
     902  pull a ipv6address
     903*/
     904#define IPV6_BYTES 16
     905#define IPV6_ADDR_STR_LEN 39
     906_PUBLIC_ enum ndr_err_code ndr_pull_ipv6address(struct ndr_pull *ndr, int ndr_flags, const char **address)
     907{
     908        uint8_t addr[IPV6_BYTES];
     909        char *addr_str = talloc_strdup(ndr->current_mem_ctx, "");
     910        int i;
     911        NDR_CHECK(ndr_pull_array_uint8(ndr, ndr_flags, addr, IPV6_BYTES));
     912        for (i = 0; i < IPV6_BYTES; ++i) {
     913                addr_str = talloc_asprintf_append(addr_str, "%02x", addr[i]);
     914                /* We need a ':' every second byte but the last one */
     915                if (i%2 == 1 && i != (IPV6_BYTES - 1)) {
     916                        addr_str = talloc_strdup_append(addr_str, ":");
     917                }
     918        }
     919        *address = addr_str;
     920        NDR_ERR_HAVE_NO_MEMORY(*address);
     921        return NDR_ERR_SUCCESS;
     922}
     923
     924/*
     925  push a ipv6address
     926*/
     927_PUBLIC_ enum ndr_err_code ndr_push_ipv6address(struct ndr_push *ndr, int ndr_flags, const char *address)
     928{
     929#ifdef AF_INET6
     930        uint8_t addr[IPV6_BYTES];
     931        int ret;
     932
     933        if (!is_ipaddress(address)) {
     934                return ndr_push_error(ndr, NDR_ERR_IPV6ADDRESS,
     935                                      "Invalid IPv6 address: '%s'",
     936                                      address);
     937        }
     938        ret = inet_pton(AF_INET6, address, addr);
     939        if (ret <= 0) {
     940                return NDR_ERR_IPV6ADDRESS;
     941        }
     942
     943        NDR_CHECK(ndr_push_array_uint8(ndr, ndr_flags, addr, IPV6_BYTES));
     944
     945        return NDR_ERR_SUCCESS;
     946#else
     947        return NDR_ERR_IPV6ADDRESS;
     948#endif
     949}
     950
     951/*
     952  print a ipv6address
     953*/
     954_PUBLIC_ void ndr_print_ipv6address(struct ndr_print *ndr, const char *name,
     955                           const char *address)
     956{
     957        ndr->print(ndr, "%-25s: %s", name, address);
     958}
     959#undef IPV6_BYTES
    831960
    832961_PUBLIC_ void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type)
    833962{
    834963        ndr->print(ndr, "%s: struct %s", name, type);
     964}
     965
     966_PUBLIC_ void ndr_print_null(struct ndr_print *ndr)
     967{
     968        ndr->print(ndr, "UNEXPECTED NULL POINTER");
    835969}
    836970
     
    8911025}
    8921026
     1027_PUBLIC_ void ndr_print_int3264(struct ndr_print *ndr, const char *name, int32_t v)
     1028{
     1029        ndr->print(ndr, "%-25s: %d", name, v);
     1030}
     1031
     1032_PUBLIC_ void ndr_print_uint3264(struct ndr_print *ndr, const char *name, uint32_t v)
     1033{
     1034        ndr->print(ndr, "%-25s: 0x%08x (%u)", name, v, v);
     1035}
     1036
    8931037_PUBLIC_ void ndr_print_udlong(struct ndr_print *ndr, const char *name, uint64_t v)
    8941038{
     
    9571101}
    9581102
     1103_PUBLIC_ void ndr_print_uid_t(struct ndr_print *ndr, const char *name, uid_t u)
     1104{
     1105        ndr_print_dlong(ndr, name, u);
     1106}
     1107
     1108_PUBLIC_ void ndr_print_gid_t(struct ndr_print *ndr, const char *name, gid_t g)
     1109{
     1110        ndr_print_dlong(ndr, name, g);
     1111}
     1112
    9591113_PUBLIC_ void ndr_print_union(struct ndr_print *ndr, const char *name, int level, const char *type)
    9601114{
     
    9751129{
    9761130        int i;
     1131
     1132        if (data == NULL) {
     1133                ndr->print(ndr, "%s: ARRAY(%d) : NULL", name, count);
     1134                return;
     1135        }
    9771136
    9781137        if (count <= 600 && (ndr->flags & LIBNDR_PRINT_ARRAY_HEX)) {
     
    9981157}
    9991158
     1159static void ndr_print_asc(struct ndr_print *ndr, const uint8_t *buf, int len)
     1160{
     1161        int i;
     1162        for (i=0;i<len;i++)
     1163                ndr->print(ndr, "%c", isprint(buf[i])?buf[i]:'.');
     1164}
     1165
     1166/*
     1167  ndr_print version of dump_data()
     1168 */
     1169static void ndr_dump_data(struct ndr_print *ndr, const uint8_t *buf, int len)
     1170{
     1171        int i=0;
     1172
     1173        ndr->no_newline = true;
     1174
     1175        for (i=0;i<len;) {
     1176                if (i%16 == 0 && i<len) {
     1177                        ndr->print(ndr, "[%04X] ",i);
     1178                }
     1179
     1180                ndr->print(ndr, "%02X ",(int)buf[i]);
     1181                i++;
     1182                if (i%8 == 0) ndr->print(ndr,"  ");
     1183                if (i%16 == 0) {
     1184                        ndr_print_asc(ndr,&buf[i-16],8); ndr->print(ndr," ");
     1185                        ndr_print_asc(ndr,&buf[i-8],8); ndr->print(ndr, "\n");
     1186                }
     1187        }
     1188
     1189        if (i%16) {
     1190                int n;
     1191                n = 16 - (i%16);
     1192                ndr->print(ndr, " ");
     1193                if (n>8) ndr->print(ndr," ");
     1194                while (n--) ndr->print(ndr,"   ");
     1195                n = MIN(8,i%16);
     1196                ndr_print_asc(ndr,&buf[i-(i%16)],n); ndr->print(ndr, " ");
     1197                n = (i%16) - n;
     1198                if (n>0) ndr_print_asc(ndr,&buf[i-n],n);
     1199                ndr->print(ndr,"\n");
     1200        }
     1201
     1202        ndr->no_newline = false;
     1203}
     1204
     1205
    10001206_PUBLIC_ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r)
    10011207{
    10021208        ndr->print(ndr, "%-25s: DATA_BLOB length=%u", name, (unsigned)r.length);
    10031209        if (r.length) {
    1004                 dump_data(10, r.data, r.length);
     1210                ndr_dump_data(ndr, r.data, r.length);
    10051211        }
    10061212}
     
    10691275        return ret + data->length;
    10701276}
     1277
     1278_PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b)
     1279{
     1280        ndr->print(ndr, "%-25s: %s", name, b?"true":"false");
     1281}
     1282
     1283_PUBLIC_ NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
     1284{
     1285        switch (ndr_err) {
     1286        case NDR_ERR_SUCCESS:
     1287                return NT_STATUS_OK;
     1288        case NDR_ERR_BUFSIZE:
     1289                return NT_STATUS_BUFFER_TOO_SMALL;
     1290        case NDR_ERR_TOKEN:
     1291                return NT_STATUS_INTERNAL_ERROR;
     1292        case NDR_ERR_ALLOC:
     1293                return NT_STATUS_NO_MEMORY;
     1294        case NDR_ERR_ARRAY_SIZE:
     1295                return NT_STATUS_ARRAY_BOUNDS_EXCEEDED;
     1296        case NDR_ERR_INVALID_POINTER:
     1297                return NT_STATUS_INVALID_PARAMETER_MIX;
     1298        case NDR_ERR_UNREAD_BYTES:
     1299                return NT_STATUS_PORT_MESSAGE_TOO_LONG;
     1300        default:
     1301                break;
     1302        }
     1303
     1304        /* we should map all error codes to different status codes */
     1305        return NT_STATUS_INVALID_PARAMETER;
     1306}
  • trunk/server/librpc/ndr/ndr_compression.c

    r414 r745  
    392392        z_stream z;
    393393
    394         ndrpush = ndr_push_init_ctx(subndr, subndr->iconv_convenience);
     394        ndrpush = ndr_push_init_ctx(subndr);
    395395        NDR_ERR_HAVE_NO_MEMORY(ndrpush);
    396396
     
    431431        comndr->data_size       = uncompressed.length;
    432432        comndr->offset          = 0;
    433 
    434         comndr->iconv_convenience = talloc_reference(comndr, subndr->iconv_convenience);
    435433
    436434        *_comndr = comndr;
     
    466464        }
    467465
    468         uncomndr = ndr_push_init_ctx(subndr, subndr->iconv_convenience);
     466        uncomndr = ndr_push_init_ctx(subndr);
    469467        NDR_ERR_HAVE_NO_MEMORY(uncomndr);
    470468        uncomndr->flags = subndr->flags;
     
    493491        ndrpull->offset         = 0;
    494492
    495         ndrpull->iconv_convenience = talloc_reference(ndrpull, subndr->iconv_convenience);
    496 
    497493        switch (compression_alg) {
    498494        case NDR_COMPRESSION_MSZIP:
  • trunk/server/librpc/ndr/ndr_compression.h

    r414 r745  
     1/*
     2   Unix SMB/CIFS implementation.
     3
     4   libndr compression support
     5
     6   Copyright (C) Stefan Metzmacher 2005
     7   Copyright (C) Matthieu Suiche 2008
     8
     9   This program is free software; you can redistribute it and/or modify
     10   it under the terms of the GNU General Public License as published by
     11   the Free Software Foundation; either version 3 of the License, or
     12   (at your option) any later version.
     13
     14   This program is distributed in the hope that it will be useful,
     15   but WITHOUT ANY WARRANTY; without even the implied warranty of
     16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17   GNU General Public License for more details.
     18
     19   You should have received a copy of the GNU General Public License
     20   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     21*/
     22
    123#ifndef __LIBRPC_NDR_NDR_COMPRESSION_H__
    224#define __LIBRPC_NDR_NDR_COMPRESSION_H__
  • trunk/server/librpc/ndr/ndr_drsblobs.c

    r414 r745  
    55
    66   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
     7   Copyright (C) Guenther Deschner <gd@samba.org> 2010
    78   
    89   This program is free software; you can redistribute it and/or modify
     
    2223#include "includes.h"
    2324#include "librpc/gen_ndr/ndr_drsblobs.h"
     25#include "../lib/util/asn1.h"
    2426
    25 /* parser auto-generated by pidl, then hand-modified by abartlet */
    26 
    27 /* Modified to have 'count' specified */
    28 static enum ndr_err_code ndr_push_AuthenticationInformationArray_with_count(struct ndr_push *ndr, int ndr_flags, int count,
    29                                                                  const struct AuthenticationInformationArray *r)
     27_PUBLIC_ enum ndr_err_code ndr_push_AuthenticationInformationArray(struct ndr_push *ndr, int ndr_flags, const struct AuthenticationInformationArray *r)
    3028{
    3129        uint32_t cntr_array_0;
    3230        if (ndr_flags & NDR_SCALARS) {
    3331                NDR_CHECK(ndr_push_align(ndr, 4));
    34                 for (cntr_array_0 = 0; cntr_array_0 < count; cntr_array_0++) {
     32                for (cntr_array_0 = 0; cntr_array_0 < r->count; cntr_array_0++) {
    3533                        NDR_CHECK(ndr_push_AuthenticationInformation(ndr, NDR_SCALARS, &r->array[cntr_array_0]));
    3634                }
     35                NDR_CHECK(ndr_push_trailer_align(ndr, 4));
    3736        }
    3837        if (ndr_flags & NDR_BUFFERS) {
    39                 for (cntr_array_0 = 0; cntr_array_0 < count; cntr_array_0++) {
    40                         NDR_CHECK(ndr_push_AuthenticationInformation(ndr, NDR_BUFFERS, &r->array[cntr_array_0]));
    41                 }
    4238        }
    4339        return NDR_ERR_SUCCESS;
    4440}
    4541
    46 /* Modified to have 'count' specified, and to allocate the array */
    47 static enum ndr_err_code ndr_pull_AuthenticationInformationArray_with_count(struct ndr_pull *ndr, int ndr_flags, int count, struct AuthenticationInformationArray *r)
     42_PUBLIC_ enum ndr_err_code ndr_pull_AuthenticationInformationArray(struct ndr_pull *ndr, int ndr_flags, struct AuthenticationInformationArray *r)
    4843{
    49         uint32_t cntr_array_0;
    50         TALLOC_CTX *_mem_save_array_0;
    5144        if (ndr_flags & NDR_SCALARS) {
    52                 NDR_CHECK(ndr_pull_align(ndr, 4));
    53                 NDR_PULL_ALLOC_N(ndr, r->array, count);
    54                 _mem_save_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
    55                 NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
    56                 for (cntr_array_0 = 0; cntr_array_0 < count; cntr_array_0++) {
    57                         NDR_CHECK(ndr_pull_AuthenticationInformation(ndr, NDR_SCALARS, &r->array[cntr_array_0]));
     45                r->count = 0;
     46                NDR_PULL_ALLOC_N(ndr, r->array, r->count);
     47                /* entry is at least 16 bytes large */
     48                while (ndr->offset + 16 <= ndr->data_size) {
     49                        r->array = talloc_realloc(ndr, r->array, struct AuthenticationInformation, r->count + 1);
     50                        NDR_ERR_HAVE_NO_MEMORY(r->array);
     51                        NDR_CHECK(ndr_pull_AuthenticationInformation(ndr, NDR_SCALARS, &r->array[r->count]));
     52                        r->count++;
    5853                }
    59                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_0, 0);
     54                NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
    6055        }
    6156        if (ndr_flags & NDR_BUFFERS) {
    62                 for (cntr_array_0 = 0; cntr_array_0 < count; cntr_array_0++) {
    63                         NDR_CHECK(ndr_pull_AuthenticationInformation(ndr, NDR_BUFFERS, &r->array[cntr_array_0]));
    64                 }
    6557        }
    6658        return NDR_ERR_SUCCESS;
    6759}
    6860
    69 /* Modified to have 'count' specified */
    70 _PUBLIC_ void ndr_print_AuthenticationInformationArray_with_count(struct ndr_print *ndr, const char *name, int count, const struct AuthenticationInformationArray *r)
    71 {
    72         uint32_t cntr_array_0;
    73         ndr_print_struct(ndr, name, "AuthenticationInformationArray");
    74         ndr->depth++;
    75         ndr->print(ndr, "%s: ARRAY(%d)", "array", (int)1);
    76         ndr->depth++;
    77         for (cntr_array_0=0;cntr_array_0<count;cntr_array_0++) {
    78                 char *idx_0=NULL;
    79                 if (asprintf(&idx_0, "[%d]", cntr_array_0) != -1) {
    80                         ndr_print_AuthenticationInformation(ndr, "array", &r->array[cntr_array_0]);
    81                         free(idx_0);
    82                 }
    83         }
    84         ndr->depth--;
    85         ndr->depth--;
    86 }
    87 
    88 /* Modified to call AuthenticationInformationArray with 'count' specified */
    8961_PUBLIC_ enum ndr_err_code ndr_push_trustAuthInOutBlob(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutBlob *r)
    9062{
     
    9264                NDR_CHECK(ndr_push_align(ndr, 4));
    9365                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
    94                 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->current));
    95                 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous));
     66                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, (r->count > 0)?12:0));
     67                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, (r->count > 0)?12 + ndr_size_AuthenticationInformationArray(&r->current, ndr_flags):0));
     68                {
     69                        struct ndr_push *_ndr_current;
     70                        NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_current, 0, ((r->count > 0)?12 + ndr_size_AuthenticationInformationArray(&r->current, ndr_flags):0) - ((r->count > 0)?12:0)));
     71                        NDR_CHECK(ndr_push_AuthenticationInformationArray(_ndr_current, NDR_SCALARS, &r->current));
     72                        NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_current, 0, ((r->count > 0)?12 + ndr_size_AuthenticationInformationArray(&r->current, ndr_flags):0) - ((r->count > 0)?12:0)));
     73                }
     74                {
     75                        uint32_t _flags_save_AuthenticationInformationArray = ndr->flags;
     76                        ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
     77                        {
     78                                struct ndr_push *_ndr_previous;
     79                                NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_previous, 0, -1));
     80                                NDR_CHECK(ndr_push_AuthenticationInformationArray(_ndr_previous, NDR_SCALARS, &r->previous));
     81                                NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_previous, 0, -1));
     82                        }
     83                        ndr->flags = _flags_save_AuthenticationInformationArray;
     84                }
     85                NDR_CHECK(ndr_push_trailer_align(ndr, 4));
    9686        }
    9787        if (ndr_flags & NDR_BUFFERS) {
    98                 if (r->current) {
    99                         NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->current));
    100                         NDR_CHECK(ndr_push_AuthenticationInformationArray_with_count(ndr, NDR_SCALARS|NDR_BUFFERS, r->count, r->current));
    101                         NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->current));
    102                 }
    103                 if (r->previous) {
    104                         NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->previous));
    105                         NDR_CHECK(ndr_push_AuthenticationInformationArray_with_count(ndr, NDR_SCALARS|NDR_BUFFERS, r->count, r->previous));
    106                         NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->previous));
    107                 }
    10888        }
    10989        return NDR_ERR_SUCCESS;
    11090}
    11191
    112 _PUBLIC_ enum ndr_err_code ndr_pull_trustAuthInOutBlob(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutBlob *r)
    113 {
    114         uint32_t _ptr_current;
    115         TALLOC_CTX *_mem_save_current_0;
    116         uint32_t _ptr_previous;
    117         TALLOC_CTX *_mem_save_previous_0;
    118         if (ndr_flags & NDR_SCALARS) {
    119                 NDR_CHECK(ndr_pull_align(ndr, 4));
    120                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
    121                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_current));
    122                 if (_ptr_current) {
    123                         NDR_PULL_ALLOC(ndr, r->current);
    124                         NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->current, _ptr_current));
    125                 } else {
    126                         r->current = NULL;
    127                 }
    128                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous));
    129                 if (_ptr_previous) {
    130                         NDR_PULL_ALLOC(ndr, r->previous);
    131                         NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous, _ptr_previous));
    132                 } else {
    133                         r->previous = NULL;
    134                 }
    135         }
    136         if (ndr_flags & NDR_BUFFERS) {
    137                 if (r->current) {
    138                         uint32_t _relative_save_offset;
    139                         _relative_save_offset = ndr->offset;
    140                         NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->current));
    141                         _mem_save_current_0 = NDR_PULL_GET_MEM_CTX(ndr);
    142                         NDR_PULL_SET_MEM_CTX(ndr, r->current, 0);
    143                         NDR_CHECK(ndr_pull_AuthenticationInformationArray_with_count(ndr, NDR_SCALARS|NDR_BUFFERS, r->count, r->current));
    144                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_current_0, 0);
    145                         ndr->offset = _relative_save_offset;
    146                 }
    147                 if (r->previous) {
    148                         uint32_t _relative_save_offset;
    149                         _relative_save_offset = ndr->offset;
    150                         NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous));
    151                         _mem_save_previous_0 = NDR_PULL_GET_MEM_CTX(ndr);
    152                         NDR_PULL_SET_MEM_CTX(ndr, r->previous, 0);
    153                         NDR_CHECK(ndr_pull_AuthenticationInformationArray_with_count(ndr, NDR_SCALARS|NDR_BUFFERS, r->count, r->previous));
    154                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_0, 0);
    155                         ndr->offset = _relative_save_offset;
    156                 }
    157         }
    158         return NDR_ERR_SUCCESS;
    159 }
    160 
    161 _PUBLIC_ void ndr_print_trustAuthInOutBlob(struct ndr_print *ndr, const char *name, const struct trustAuthInOutBlob *r)
    162 {
    163         ndr_print_struct(ndr, name, "trustAuthInOutBlob");
    164         ndr->depth++;
    165         ndr_print_uint32(ndr, "count", r->count);
    166         ndr_print_ptr(ndr, "current", r->current);
    167         ndr->depth++;
    168         if (r->current) {
    169                 ndr_print_AuthenticationInformationArray_with_count(ndr, "current", r->count, r->current);
    170         }
    171         ndr->depth--;
    172         ndr_print_ptr(ndr, "previous", r->previous);
    173         ndr->depth++;
    174         if (r->previous) {
    175                 ndr_print_AuthenticationInformationArray_with_count(ndr, "previous", r->count, r->previous);
    176         }
    177         ndr->depth--;
    178         ndr->depth--;
    179 }
    18092
    18193_PUBLIC_ enum ndr_err_code ndr_pull_trustDomainPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustDomainPasswords *r)
     
    197109                        struct ndr_pull *_ndr_outgoing;
    198110                        NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_outgoing, 0, r->outgoing_size));
    199                         NDR_CHECK(ndr_pull_trustCurrentPasswords(_ndr_outgoing, NDR_SCALARS|NDR_BUFFERS, &r->outgoing));
     111                        NDR_CHECK(ndr_pull_trustAuthInOutBlob(_ndr_outgoing, NDR_SCALARS|NDR_BUFFERS, &r->outgoing));
    200112                        NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_outgoing, 0, r->outgoing_size));
    201113                }
     
    203115                        struct ndr_pull *_ndr_incoming;
    204116                        NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_incoming, 0, r->incoming_size));
    205                         NDR_CHECK(ndr_pull_trustCurrentPasswords(_ndr_incoming, NDR_SCALARS|NDR_BUFFERS, &r->incoming));
     117                        NDR_CHECK(ndr_pull_trustAuthInOutBlob(_ndr_incoming, NDR_SCALARS|NDR_BUFFERS, &r->incoming));
    206118                        NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_incoming, 0, r->incoming_size));
    207119                }
     
    214126}
    215127
     128_PUBLIC_ void ndr_print_drsuapi_MSPrefixMap_Entry(struct ndr_print *ndr, const char *name, const struct drsuapi_MSPrefixMap_Entry *r)
     129{
     130        ndr_print_struct(ndr, name, "drsuapi_MSPrefixMap_Entry");
     131        {
     132                uint32_t _flags_save_STRUCT = ndr->flags;
     133                ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
     134                ndr->depth++;
     135                ndr_print_uint16(ndr, "entryID", r->entryID);
     136                ndr->print(ndr, "%-25s: length=%u", "oid", r->length);
     137                if (r->binary_oid) {
     138                        char *partial_oid = NULL;
     139                        DATA_BLOB oid_blob = data_blob_const(r->binary_oid, r->length);
     140                        char *hex_str = data_blob_hex_string_upper(ndr, &oid_blob);
     141                        ber_read_partial_OID_String(ndr, oid_blob, &partial_oid);
     142                        ndr->depth++;
     143                        ndr->print(ndr, "%-25s: 0x%s (%s)", "binary_oid", hex_str, partial_oid);
     144                        ndr->depth--;
     145                        talloc_free(hex_str);
     146                        talloc_free(partial_oid);
     147                }
     148                ndr->depth--;
     149                ndr->flags = _flags_save_STRUCT;
     150        }
     151}
  • trunk/server/librpc/ndr/ndr_drsblobs.h

    r414 r745  
    2020*/
    2121
    22 _PUBLIC_ void ndr_print_AuthenticationInformationArray_with_count(struct ndr_print *ndr, const char *name, int count, const struct AuthenticationInformationArray *r);
    23 _PUBLIC_ enum ndr_err_code ndr_push_trustAuthInOutBlob(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutBlob *r);
    24 _PUBLIC_ enum ndr_err_code ndr_pull_trustAuthInOutBlob(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutBlob *r);
    25 _PUBLIC_ void ndr_print_trustAuthInOutBlob(struct ndr_print *ndr, const char *name, const struct trustAuthInOutBlob *r);
    2622_PUBLIC_ enum ndr_err_code ndr_pull_trustDomainPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustDomainPasswords *r);
    27 
     23_PUBLIC_ void ndr_print_drsuapi_MSPrefixMap_Entry(struct ndr_print *ndr, const char *name, const struct drsuapi_MSPrefixMap_Entry *r);
  • trunk/server/librpc/ndr/ndr_drsuapi.c

    r414 r745  
    6767}
    6868
    69 #define _OID_PUSH_CHECK(call) do { \
    70         bool _status; \
    71         _status = call; \
    72         if (_status != true) { \
    73                 return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "OID Conversion Error: %s\n", __location__); \
    74         } \
    75 } while (0)
    76 
    77 #define _OID_PULL_CHECK(call) do { \
    78         bool _status; \
    79         _status = call; \
    80         if (_status != true) { \
    81                 return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "OID Conversion Error: %s\n", __location__); \
    82         } \
    83 } while (0)
    84 
    85 enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsReplicaOID *r)
    86 {
    87         if (ndr_flags & NDR_SCALARS) {
    88                 NDR_CHECK(ndr_push_align(ndr, 4));
    89                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_drsuapi_DsReplicaOID_oid(r->oid, 0)));
    90                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->oid));
    91         }
    92         if (ndr_flags & NDR_BUFFERS) {
    93                 if (r->oid) {
    94                         DATA_BLOB blob;
    95 
    96                         if (strncasecmp("ff", r->oid, 2) == 0) {
    97                                 blob = strhex_to_data_blob(ndr, r->oid);
    98                                 if (!blob.data) {
    99                                         return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT,
    100                                                               "HEX String Conversion Error: %s\n",
    101                                                               __location__);
    102                                 }
    103                         } else {
    104                                 _OID_PUSH_CHECK(ber_write_OID_String(&blob, r->oid));
    105                                 talloc_steal(ndr, blob.data);
    106                         }
    107 
    108                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length));
    109                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, blob.data, blob.length));
    110                 }
    111         }
    112         return NDR_ERR_SUCCESS;
    113 }
    114 
    115 enum ndr_err_code ndr_pull_drsuapi_DsReplicaOID(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsReplicaOID *r)
    116 {
    117         uint32_t _ptr_oid;
    118         TALLOC_CTX *_mem_save_oid_0;
    119         if (ndr_flags & NDR_SCALARS) {
    120                 NDR_CHECK(ndr_pull_align(ndr, 4));
    121                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__ndr_size));
    122                 if (r->__ndr_size < 0 || r->__ndr_size > 10000) {
    123                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
    124                 }
    125                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_oid));
    126                 if (_ptr_oid) {
    127                         NDR_PULL_ALLOC(ndr, r->oid);
    128                 } else {
    129                         r->oid = NULL;
    130                 }
    131         }
    132         if (ndr_flags & NDR_BUFFERS) {
    133                 if (r->oid) {
    134                         DATA_BLOB _oid_array;
    135                         const char *_oid;
    136 
    137                         _mem_save_oid_0 = NDR_PULL_GET_MEM_CTX(ndr);
    138                         NDR_PULL_SET_MEM_CTX(ndr, ndr, 0);
    139                         NDR_CHECK(ndr_pull_array_size(ndr, &r->oid));
    140                         _oid_array.length = ndr_get_array_size(ndr, &r->oid);
    141                         NDR_PULL_ALLOC_N(ndr, _oid_array.data, _oid_array.length);
    142                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, _oid_array.data, _oid_array.length));
    143                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_oid_0, 0);
    144 
    145                         if (_oid_array.length && _oid_array.data[0] == 0xFF) {
    146                                 _oid = data_blob_hex_string(ndr, &_oid_array);
    147                                 NDR_ERR_HAVE_NO_MEMORY(_oid);
    148                         } else {
    149                                 _OID_PULL_CHECK(ber_read_OID_String(ndr, _oid_array, &_oid));
    150                         }
    151                         data_blob_free(&_oid_array);
    152                         talloc_steal(r->oid, _oid);
    153                         r->oid = _oid;
    154                 }
    155                 if (r->oid) {
    156                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->oid, r->__ndr_size));
    157                 }
    158         }
    159         return NDR_ERR_SUCCESS;
    160 }
    161 
    162 size_t ndr_size_drsuapi_DsReplicaOID_oid(const char *oid, int flags)
    163 {
    164         DATA_BLOB _blob;
    165         size_t ret = 0;
    166 
    167         if (!oid) return 0;
    168 
    169         if (strncasecmp("ff", oid, 2) == 0) {
    170                 _blob = strhex_to_data_blob(NULL, oid);
    171                 if (_blob.data) {
    172                         ret = _blob.length;
    173                 }
     69_PUBLIC_ void ndr_print_drsuapi_DsReplicaOID(struct ndr_print *ndr, const char *name, const struct drsuapi_DsReplicaOID *r)
     70{
     71        ndr_print_struct(ndr, name, "drsuapi_DsReplicaOID");
     72        ndr->depth++;
     73        ndr_print_uint32(ndr, "length", r->length);
     74        ndr->print(ndr, "%-25s: length=%u", "oid", r->length);
     75        if (r->binary_oid) {
     76                char *partial_oid = NULL;
     77                DATA_BLOB oid_blob = data_blob_const(r->binary_oid, r->length);
     78                char *hex_str = data_blob_hex_string_upper(ndr, &oid_blob);
     79                ber_read_partial_OID_String(ndr, oid_blob, &partial_oid);
     80                ndr->depth++;
     81                ndr->print(ndr, "%-25s: 0x%s (%s)", "binary_oid", hex_str, partial_oid);
     82                ndr->depth--;
     83                talloc_free(hex_str);
     84                talloc_free(partial_oid);
     85        }
     86        ndr->depth--;
     87}
     88
     89static void _print_drsuapi_DsAttributeValue_attid(struct ndr_print *ndr, const char *name,
     90                                                  const struct drsuapi_DsAttributeValue *r)
     91{
     92        uint32_t v;
     93
     94        ndr_print_struct(ndr, name, "drsuapi_DsAttributeValue");
     95        ndr->depth++;
     96        v = IVAL(r->blob->data, 0);
     97        ndr_print_uint32(ndr, "attid", v);
     98        ndr->depth--;
     99}
     100
     101static void _print_drsuapi_DsAttributeValue_str(struct ndr_print *ndr, const char *name,
     102                                                const struct drsuapi_DsAttributeValue *r)
     103{
     104        char *str;
     105
     106        ndr_print_struct(ndr, name, "drsuapi_DsAttributeValue");
     107        ndr->depth++;
     108        if (!convert_string_talloc(ndr,
     109                                   CH_UTF16, CH_UNIX,
     110                                   r->blob->data,
     111                                   r->blob->length,
     112                                   (void **)&str, NULL, false)) {
     113                ndr_print_string(ndr, "string", "INVALID CONVERSION");
    174114        } else {
    175                 if (ber_write_OID_String(&_blob, oid)) {
    176                         ret = _blob.length;
    177                 }
    178         }
    179         data_blob_free(&_blob);
    180         return ret;
     115                ndr_print_string(ndr, "string", str);
     116                talloc_free(str);
     117        }
     118        ndr->depth--;
     119}
     120
     121static void _print_drsuapi_DsAttributeValueCtr(struct ndr_print *ndr,
     122                                               const char *name,
     123                                               const struct drsuapi_DsAttributeValueCtr *r,
     124                                               void (*print_val_fn)(struct ndr_print *ndr, const char *name, const struct drsuapi_DsAttributeValue *r))
     125{
     126        uint32_t cntr_values_1;
     127        ndr_print_struct(ndr, name, "drsuapi_DsAttributeValueCtr");
     128        ndr->depth++;
     129        ndr_print_uint32(ndr, "num_values", r->num_values);
     130        ndr_print_ptr(ndr, "values", r->values);
     131        ndr->depth++;
     132        if (r->values) {
     133                ndr->print(ndr, "%s: ARRAY(%d)", "values", (int)r->num_values);
     134                ndr->depth++;
     135                for (cntr_values_1=0;cntr_values_1<r->num_values;cntr_values_1++) {
     136                        char *idx_1=NULL;
     137                        if (asprintf(&idx_1, "[%d]", cntr_values_1) != -1) {
     138                                //ndr_print_drsuapi_DsAttributeValue(ndr, "values", &r->values[cntr_values_1]);
     139                                print_val_fn(ndr, "values", &r->values[cntr_values_1]);
     140                                free(idx_1);
     141                        }
     142                }
     143                ndr->depth--;
     144        }
     145        ndr->depth--;
     146        ndr->depth--;
     147}
     148
     149_PUBLIC_ void ndr_print_drsuapi_DsReplicaAttribute(struct ndr_print *ndr,
     150                                                   const char *name,
     151                                                   const struct drsuapi_DsReplicaAttribute *r)
     152{
     153        ndr_print_struct(ndr, name, "drsuapi_DsReplicaAttribute");
     154        ndr->depth++;
     155        ndr_print_drsuapi_DsAttributeId(ndr, "attid", r->attid);
     156        switch (r->attid) {
     157        case DRSUAPI_ATTID_objectClass:
     158        case DRSUAPI_ATTID_possSuperiors:
     159        case DRSUAPI_ATTID_subClassOf:
     160        case DRSUAPI_ATTID_governsID:
     161        case DRSUAPI_ATTID_mustContain:
     162        case DRSUAPI_ATTID_mayContain:
     163        case DRSUAPI_ATTID_rDNAttId:
     164        case DRSUAPI_ATTID_attributeID:
     165        case DRSUAPI_ATTID_attributeSyntax:
     166        case DRSUAPI_ATTID_auxiliaryClass:
     167        case DRSUAPI_ATTID_systemPossSuperiors:
     168        case DRSUAPI_ATTID_systemMayContain:
     169        case DRSUAPI_ATTID_systemMustContain:
     170        case DRSUAPI_ATTID_systemAuxiliaryClass:
     171        case DRSUAPI_ATTID_transportAddressAttribute:
     172                /* ATTIDs for classSchema and attributeSchema */
     173                _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
     174                                                   _print_drsuapi_DsAttributeValue_attid);
     175                break;
     176        case DRSUAPI_ATTID_cn:
     177        case DRSUAPI_ATTID_ou:
     178        case DRSUAPI_ATTID_description:
     179        case DRSUAPI_ATTID_displayName:
     180        case DRSUAPI_ATTID_dMDLocation:
     181        case DRSUAPI_ATTID_adminDisplayName:
     182        case DRSUAPI_ATTID_adminDescription:
     183        case DRSUAPI_ATTID_lDAPDisplayName:
     184        case DRSUAPI_ATTID_name:
     185                _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
     186                                                   _print_drsuapi_DsAttributeValue_str);
     187                break;
     188        default:
     189                _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
     190                                                   ndr_print_drsuapi_DsAttributeValue);
     191                break;
     192        }
     193        ndr->depth--;
    181194}
    182195
     
    353366}
    354367
    355 _PUBLIC_ size_t ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(const struct drsuapi_DsReplicaObjectIdentifier3Binary *r, struct smb_iconv_convenience *ic, int flags)
    356 {
    357         return ndr_size_struct((const struct drsuapi_DsReplicaObjectIdentifier3 *)r, flags, (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3, ic);
    358 }
    359 
     368_PUBLIC_ size_t ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(const struct drsuapi_DsReplicaObjectIdentifier3Binary *r, int flags)
     369{
     370        return ndr_size_struct((const struct drsuapi_DsReplicaObjectIdentifier3 *)r, flags, (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
     371}
     372
     373_PUBLIC_ void ndr_print_drsuapi_SecBufferType(struct ndr_print *ndr, const char *name, enum drsuapi_SecBufferType r)
     374{
     375        const char *val = NULL;
     376
     377        switch (r & 0x00000007) {
     378                case DRSUAPI_SECBUFFER_EMPTY: val = "DRSUAPI_SECBUFFER_EMPTY"; break;
     379                case DRSUAPI_SECBUFFER_DATA: val = "DRSUAPI_SECBUFFER_DATA"; break;
     380                case DRSUAPI_SECBUFFER_TOKEN: val = "DRSUAPI_SECBUFFER_TOKEN"; break;
     381                case DRSUAPI_SECBUFFER_PKG_PARAMS: val = "DRSUAPI_SECBUFFER_PKG_PARAMS"; break;
     382                case DRSUAPI_SECBUFFER_MISSING: val = "DRSUAPI_SECBUFFER_MISSING"; break;
     383                case DRSUAPI_SECBUFFER_EXTRA: val = "DRSUAPI_SECBUFFER_EXTRA"; break;
     384                case DRSUAPI_SECBUFFER_STREAM_TRAILER: val = "DRSUAPI_SECBUFFER_STREAM_TRAILER"; break;
     385                case DRSUAPI_SECBUFFER_STREAM_HEADER: val = "DRSUAPI_SECBUFFER_STREAM_HEADER"; break;
     386        }
     387
     388        if (r & DRSUAPI_SECBUFFER_READONLY) {
     389                char *v = talloc_asprintf(ndr, "DRSUAPI_SECBUFFER_READONLY | %s", val);
     390                ndr_print_enum(ndr, name, "ENUM", v, r);
     391        } else {
     392                ndr_print_enum(ndr, name, "ENUM", val, r);
     393        }
     394}
     395
     396_PUBLIC_ void ndr_print_drsuapi_DsAddEntry_AttrErrListItem_V1(struct ndr_print *ndr, const char *name, const struct drsuapi_DsAddEntry_AttrErrListItem_V1 *r)
     397{
     398        ndr_print_struct(ndr, name, "drsuapi_DsAddEntry_AttrErrListItem_V1");
     399        ndr->depth++;
     400        ndr_print_ptr(ndr, "next", r->next);
     401        ndr_print_drsuapi_DsAddEntry_AttrErr_V1(ndr, "err_data", &r->err_data);
     402        ndr->depth--;
     403        if (r->next) {
     404                ndr_print_drsuapi_DsAddEntry_AttrErrListItem_V1(ndr, "next", r->next);
     405        }
     406}
  • trunk/server/librpc/ndr/ndr_drsuapi.h

    r414 r745  
    2929                                                 const struct drsuapi_DsReplicaObjectListItemEx *r);
    3030
    31 enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsReplicaOID *r);
    32 enum ndr_err_code ndr_pull_drsuapi_DsReplicaOID(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsReplicaOID *r);
    33 size_t ndr_size_drsuapi_DsReplicaOID_oid(const char *oid, int flags);
     31size_t ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(const struct drsuapi_DsReplicaObjectIdentifier3Binary *r, int flags);
    3432
    35 size_t ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(const struct drsuapi_DsReplicaObjectIdentifier3Binary *r, struct smb_iconv_convenience *ic, int flags);
    3633
    3734#endif /* _LIBRPC_NDR_NDR_DRSUAPI_H */
  • trunk/server/librpc/ndr/ndr_frsrpc.c

    r414 r745  
    8585
    8686size_t ndr_size_frsrpc_CommPktChunkCtr(const struct frsrpc_CommPktChunkCtr *r,
    87                                        struct smb_iconv_convenience *ic,
    8887                                       int flags)
    8988{
    9089        flags |= LIBNDR_FLAG_NOALIGN;
    9190        return ndr_size_struct(r, flags,
    92                         (ndr_push_flags_fn_t)ndr_push_frsrpc_CommPktChunkCtr,
    93                         ic);
     91                        (ndr_push_flags_fn_t)ndr_push_frsrpc_CommPktChunkCtr);
    9492}
  • trunk/server/librpc/ndr/ndr_frsrpc.h

    r414 r745  
    3030                                        struct frsrpc_CommPktChunkCtr *r);
    3131size_t ndr_size_frsrpc_CommPktChunkCtr(const struct frsrpc_CommPktChunkCtr *r,
    32                                        struct smb_iconv_convenience *ic,
    3332                                       int flags);
    3433
  • trunk/server/librpc/ndr/ndr_krb5pac.c

    r414 r745  
    2424#include "librpc/gen_ndr/ndr_krb5pac.h"
    2525
    26 static size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
     26static size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags)
    2727{
    28         size_t s = ndr_size_PAC_INFO(r, level, ic, flags);
     28        size_t s = ndr_size_PAC_INFO(r, level, flags);
    2929        switch (level) {
    3030                case PAC_TYPE_LOGON_INFO:
     
    3535}
    3636
    37 static size_t _subcontext_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
     37static size_t _subcontext_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags)
    3838{
    39         size_t s = ndr_size_PAC_INFO(r, level, ic, flags);
     39        size_t s = ndr_size_PAC_INFO(r, level, flags);
    4040        return NDR_ROUND(s,8);
    4141}
     
    4646                NDR_CHECK(ndr_push_align(ndr, 4));
    4747                NDR_CHECK(ndr_push_PAC_TYPE(ndr, NDR_SCALARS, r->type));
    48                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, _ndr_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience,0)));
     48                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, _ndr_size_PAC_INFO(r->info,r->type,0)));
    4949                {
    5050                        uint32_t _flags_save_PAC_INFO = ndr->flags;
     
    6363                                {
    6464                                        struct ndr_push *_ndr_info;
    65                                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience, 0)));
     65                                        NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,0)));
    6666                                        NDR_CHECK(ndr_push_set_switch_value(_ndr_info, r->info, r->type));
    6767                                        NDR_CHECK(ndr_push_PAC_INFO(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->info));
    68                                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience,0)));
     68                                        NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,0)));
    6969                                }
    7070                                NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->info));
     
    129129        ndr->depth++;
    130130        ndr_print_PAC_TYPE(ndr, "type", r->type);
    131         ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?_ndr_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience,0):r->_ndr_size);
     131        ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?_ndr_size_PAC_INFO(r->info,r->type,0):r->_ndr_size);
    132132        ndr_print_ptr(ndr, "info", r->info);
    133133        ndr->depth++;
  • trunk/server/librpc/ndr/ndr_ntlmssp.c

    r414 r745  
    109109
    110110_PUBLIC_ void ndr_print_ntlmssp_nt_response(TALLOC_CTX *mem_ctx,
    111                                             struct smb_iconv_convenience *ic,
    112111                                            const DATA_BLOB *nt_response,
    113112                                            bool ntlmv2)
     
    118117                struct NTLMv2_RESPONSE nt;
    119118                if (nt_response->length > 24) {
    120                         ndr_err = ndr_pull_struct_blob(nt_response, mem_ctx, ic, &nt,
     119                        ndr_err = ndr_pull_struct_blob(nt_response, mem_ctx, &nt,
    121120                                        (ndr_pull_flags_fn_t)ndr_pull_NTLMv2_RESPONSE);
    122121                        if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    127126                struct NTLM_RESPONSE nt;
    128127                if (nt_response->length == 24) {
    129                         ndr_err = ndr_pull_struct_blob(nt_response, mem_ctx, ic, &nt,
     128                        ndr_err = ndr_pull_struct_blob(nt_response, mem_ctx, &nt,
    130129                                        (ndr_pull_flags_fn_t)ndr_pull_NTLM_RESPONSE);
    131130                        if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    137136
    138137_PUBLIC_ void ndr_print_ntlmssp_lm_response(TALLOC_CTX *mem_ctx,
    139                                             struct smb_iconv_convenience *ic,
    140138                                            const DATA_BLOB *lm_response,
    141139                                            bool ntlmv2)
     
    146144                struct LMv2_RESPONSE lm;
    147145                if (lm_response->length == 24) {
    148                         ndr_err = ndr_pull_struct_blob(lm_response, mem_ctx, ic, &lm,
     146                        ndr_err = ndr_pull_struct_blob(lm_response, mem_ctx, &lm,
    149147                                        (ndr_pull_flags_fn_t)ndr_pull_LMv2_RESPONSE);
    150148                        if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    155153                struct LM_RESPONSE lm;
    156154                if (lm_response->length == 24) {
    157                         ndr_err = ndr_pull_struct_blob(lm_response, mem_ctx, ic, &lm,
     155                        ndr_err = ndr_pull_struct_blob(lm_response, mem_ctx, &lm,
    158156                                        (ndr_pull_flags_fn_t)ndr_pull_LM_RESPONSE);
    159157                        if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    170168        switch (level) {
    171169                case NTLMSSP_NEGOTIATE_VERSION:
    172                         ndr_print_VERSION(ndr, name, &r->version);
     170                        ndr_print_ntlmssp_VERSION(ndr, name, &r->version);
    173171                break;
    174172
  • trunk/server/librpc/ndr/ndr_ntlmssp.h

    r414 r745  
    2525_PUBLIC_ enum ndr_err_code ndr_pull_AV_PAIR_LIST(struct ndr_pull *ndr, int ndr_flags, struct AV_PAIR_LIST *r);
    2626_PUBLIC_ void ndr_print_ntlmssp_nt_response(TALLOC_CTX *mem_ctx,
    27                                             struct smb_iconv_convenience *ic,
    2827                                            const DATA_BLOB *nt_response,
    2928                                            bool ntlmv2);
    3029_PUBLIC_ void ndr_print_ntlmssp_lm_response(TALLOC_CTX *mem_ctx,
    31                                             struct smb_iconv_convenience *ic,
    3230                                            const DATA_BLOB *lm_response,
    3331                                            bool ntlmv2);
  • trunk/server/librpc/ndr/ndr_schannel.c

    r414 r745  
    8686        case NL_SIGN_HMAC_MD5: {
    8787                struct NL_AUTH_SIGNATURE r;
    88                 ndr_err = ndr_pull_struct_blob(blob, mem_ctx, NULL, &r,
     88                ndr_err = ndr_pull_struct_blob(blob, mem_ctx, &r,
    8989                       (ndr_pull_flags_fn_t)ndr_pull_NL_AUTH_SIGNATURE);
    9090                if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    9595        case NL_SIGN_HMAC_SHA256: {
    9696                struct NL_AUTH_SHA2_SIGNATURE r;
    97                 ndr_err = ndr_pull_struct_blob(blob, mem_ctx, NULL, &r,
     97                ndr_err = ndr_pull_struct_blob(blob, mem_ctx, &r,
    9898                       (ndr_pull_flags_fn_t)ndr_pull_NL_AUTH_SHA2_SIGNATURE);
    9999                if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
  • trunk/server/librpc/ndr/ndr_sec_helper.c

    r414 r745  
    2424#include "includes.h"
    2525#include "librpc/gen_ndr/ndr_security.h"
    26 #if _SAMBA_BUILD_ == 4
    27 #include "libcli/security/security.h"
    28 #endif
     26#include "../libcli/security/security.h"
    2927
    3028/*
    3129  return the wire size of a security_ace
    3230*/
    33 size_t ndr_size_security_ace(const struct security_ace *ace, struct smb_iconv_convenience *ic, int flags)
     31size_t ndr_size_security_ace(const struct security_ace *ace, int flags)
    3432{
    3533        size_t ret;
     
    3735        if (!ace) return 0;
    3836
    39         ret = 8 + ndr_size_dom_sid(&ace->trustee, ic, flags);
     37        ret = 8 + ndr_size_dom_sid(&ace->trustee, flags);
    4038
    4139        switch (ace->type) {
     
    9290  return the wire size of a security_acl
    9391*/
    94 size_t ndr_size_security_acl(const struct security_acl *theacl, struct smb_iconv_convenience *ic, int flags)
     92size_t ndr_size_security_acl(const struct security_acl *theacl, int flags)
    9593{
    9694        size_t ret;
     
    9997        ret = 8;
    10098        for (i=0;i<theacl->num_aces;i++) {
    101                 ret += ndr_size_security_ace(&theacl->aces[i], ic, flags);
     99                ret += ndr_size_security_ace(&theacl->aces[i], flags);
    102100        }
    103101        return ret;
     
    107105  return the wire size of a security descriptor
    108106*/
    109 size_t ndr_size_security_descriptor(const struct security_descriptor *sd, struct smb_iconv_convenience *ic, int flags)
     107size_t ndr_size_security_descriptor(const struct security_descriptor *sd, int flags)
    110108{
    111109        size_t ret;
     
    113111       
    114112        ret = 20;
    115         ret += ndr_size_dom_sid(sd->owner_sid, ic, flags);
    116         ret += ndr_size_dom_sid(sd->group_sid, ic, flags);
    117         ret += ndr_size_security_acl(sd->dacl, ic, flags);
    118         ret += ndr_size_security_acl(sd->sacl, ic, flags);
     113        ret += ndr_size_dom_sid(sd->owner_sid, flags);
     114        ret += ndr_size_dom_sid(sd->group_sid, flags);
     115        ret += ndr_size_security_acl(sd->dacl, flags);
     116        ret += ndr_size_security_acl(sd->sacl, flags);
    119117        return ret;
    120118}
     
    123121  return the wire size of a dom_sid
    124122*/
    125 size_t ndr_size_dom_sid(const struct dom_sid *sid, struct smb_iconv_convenience *ic, int flags)
     123size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags)
    126124{
    127125        if (!sid) return 0;
  • trunk/server/librpc/ndr/ndr_spoolss_buf.c

    r596 r745  
    6161        if (r->in.buffer) {\
    6262                DATA_BLOB _data_blob_info;\
    63                 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);\
     63                _ndr_info = ndr_push_init_ctx(ndr);\
    6464                NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
    6565                _ndr_info->flags= ndr->flags;\
     
    138138                struct ndr_pull *_ndr_info;\
    139139                NDR_PULL_ALLOC(ndr, *r->out.info);\
    140                 _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info, ndr->iconv_convenience);\
     140                _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info);\
    141141                NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
    142142                _ndr_info->flags= ndr->flags;\
     
    182182        struct __##fn __r;\
    183183        DATA_BLOB _data_blob_info;\
    184         struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
     184        struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx);\
    185185        if (!_ndr_info) return 0;\
    186186        _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
     
    197197        struct __##fn __r;\
    198198        DATA_BLOB _data_blob_info;\
    199         struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
     199        struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx);\
    200200        if (!_ndr_info) return 0;\
    201201        _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
     
    235235}
    236236
    237 uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info)
     237uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info)
    238238{
    239239        NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters);
     
    271271}
    272272
    273 uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_JobInfo *info)
     273uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_JobInfo *info)
    274274{
    275275        NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs);
     
    303303}
    304304
    305 uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_DriverInfo *info)
     305uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_DriverInfo *info)
    306306{
    307307        NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers);
     
    331331}
    332332
    333 uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_FormInfo *info)
     333uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_FormInfo *info)
    334334{
    335335        NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms);
     
    359359}
    360360
    361 uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PortInfo *info)
     361uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PortInfo *info)
    362362{
    363363        NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts);
     
    387387}
    388388
    389 uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info)
     389uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info)
    390390{
    391391        NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors);
     
    419419}
    420420
    421 uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
     421uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx,
    422422                                                   uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info)
    423423{
     
    452452}
    453453
    454 uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
     454uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx,
    455455                                                      uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info)
    456456{
     
    481481                _r.out.info     = data_blob(NULL, 0);
    482482                if (r->in.offered >= *r->out.needed) {
     483                        struct ndr_push *_subndr_info;
    483484                        struct __spoolss_EnumPrinterDataEx __r;
    484                         _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
     485                        _ndr_info = ndr_push_init_ctx(ndr);
    485486                        NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
    486487                        _ndr_info->flags= ndr->flags;
    487488                        __r.in.count    = *r->out.count;
    488489                        __r.out.info    = *r->out.info;
    489                         NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
     490                        NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));
     491                        NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_subndr_info, flags, &__r));
     492                        NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));
    490493                        if (r->in.offered > _ndr_info->offset) {
    491494                                uint32_t _padding_len = r->in.offered - _ndr_info->offset;
     
    532535                        struct ndr_pull *_ndr_info;
    533536                        NDR_PULL_ALLOC(ndr, *r->out.info);
    534                         _ndr_info = ndr_pull_init_blob(&_r.out.info, *r->out.info, ndr->iconv_convenience);
     537                        _ndr_info = ndr_pull_init_blob(&_r.out.info, *r->out.info);
    535538                        NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
    536539                        _ndr_info->flags= ndr->flags;
     
    552555}
    553556
    554 uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
     557uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx,
    555558                                                 uint32_t count, struct spoolss_PrinterEnumValues *info)
    556559{
     
    558561}
    559562
    560 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags)
     563uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, uint32_t flags)
    561564{
    562565        if (!devmode) return 0;
    563         return ndr_size_spoolss_DeviceMode(devmode,ic,flags);
    564 }
    565 
    566 _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags)
     566        return ndr_size_spoolss_DeviceMode(devmode, flags);
     567}
     568
     569_PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, int flags)
    567570{
    568571        if (!r) {
     
    570573        }
    571574
    572         return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
     575        return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray);
    573576}
    574577
     
    640643                        ndr->flags = _flags_save_string;
    641644                }
     645                NDR_CHECK(ndr_push_trailer_align(ndr, 8));
    642646        }
    643647        if (ndr_flags & NDR_BUFFERS) {
     
    665669                        NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->file_info));
    666670#if 0
    667                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
     671                        NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->file_count));
    668672#endif
    669673                        for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
     
    894898                        ndr->flags = _flags_save_string;
    895899                }
     900                NDR_CHECK(ndr_pull_trailer_align(ndr, 8));
    896901        }
    897902        if (ndr_flags & NDR_BUFFERS) {
     
    907912                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driver_name));
    908913                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_driver_name_0, 0);
     914                                if (ndr->offset > ndr->relative_highest_offset) {
     915                                        ndr->relative_highest_offset = ndr->offset;
     916                                }
    909917                                ndr->offset = _relative_save_offset;
    910918                        }
     
    922930                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->architecture));
    923931                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_architecture_0, 0);
     932                                if (ndr->offset > ndr->relative_highest_offset) {
     933                                        ndr->relative_highest_offset = ndr->offset;
     934                                }
    924935                                ndr->offset = _relative_save_offset;
    925936                        }
     
    948959                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_1, 0);
    949960                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_0, 0);
     961                        if (ndr->offset > ndr->relative_highest_offset) {
     962                                ndr->relative_highest_offset = ndr->offset;
     963                        }
    950964                        ndr->offset = _relative_save_offset;
    951965                }
     
    961975                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitor_name));
    962976                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_monitor_name_0, 0);
     977                                if (ndr->offset > ndr->relative_highest_offset) {
     978                                        ndr->relative_highest_offset = ndr->offset;
     979                                }
    963980                                ndr->offset = _relative_save_offset;
    964981                        }
     
    976993                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->default_datatype));
    977994                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_datatype_0, 0);
     995                                if (ndr->offset > ndr->relative_highest_offset) {
     996                                        ndr->relative_highest_offset = ndr->offset;
     997                                }
    978998                                ndr->offset = _relative_save_offset;
    979999                        }
     
    9911011                                NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->previous_names));
    9921012                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_names_0, 0);
     1013                                if (ndr->offset > ndr->relative_highest_offset) {
     1014                                        ndr->relative_highest_offset = ndr->offset;
     1015                                }
    9931016                                ndr->offset = _relative_save_offset;
    9941017                        }
     
    10061029                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_name));
    10071030                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_name_0, 0);
     1031                                if (ndr->offset > ndr->relative_highest_offset) {
     1032                                        ndr->relative_highest_offset = ndr->offset;
     1033                                }
    10081034                                ndr->offset = _relative_save_offset;
    10091035                        }
     
    10211047                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_url));
    10221048                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_url_0, 0);
     1049                                if (ndr->offset > ndr->relative_highest_offset) {
     1050                                        ndr->relative_highest_offset = ndr->offset;
     1051                                }
    10231052                                ndr->offset = _relative_save_offset;
    10241053                        }
     
    10361065                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->hardware_id));
    10371066                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hardware_id_0, 0);
     1067                                if (ndr->offset > ndr->relative_highest_offset) {
     1068                                        ndr->relative_highest_offset = ndr->offset;
     1069                                }
    10381070                                ndr->offset = _relative_save_offset;
    10391071                        }
     
    10511083                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->provider));
    10521084                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_provider_0, 0);
     1085                                if (ndr->offset > ndr->relative_highest_offset) {
     1086                                        ndr->relative_highest_offset = ndr->offset;
     1087                                }
    10531088                                ndr->offset = _relative_save_offset;
    10541089                        }
     
    10831118}
    10841119
    1085 _PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
     1120_PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, int flags)
    10861121{
    10871122        if (!r) {
    10881123                return 0;
    10891124        }
    1090         return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData, ic);
     1125        return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData);
    10911126}
    10921127
  • trunk/server/librpc/ndr/ndr_spoolss_buf.h

    r596 r745  
     1/*
     2   Unix SMB/CIFS implementation.
     3
     4   routines for marshalling/unmarshalling spoolss subcontext buffer structures
     5
     6   Copyright (C) Andrew Tridgell 2003
     7   Copyright (C) Tim Potter 2003
     8   Copyright (C) Guenther Deschner 2009
     9
     10   This program is free software; you can redistribute it and/or modify
     11   it under the terms of the GNU General Public License as published by
     12   the Free Software Foundation; either version 3 of the License, or
     13   (at your option) any later version.
     14
     15   This program is distributed in the hope that it will be useful,
     16   but WITHOUT ANY WARRANTY; without even the implied warranty of
     17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18   GNU General Public License for more details.
     19
     20   You should have received a copy of the GNU General Public License
     21   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     22*/
     23
    124#ifndef ___SPACE_SRC_SAMBA_SOURCES_SAMBA_GIT_SOURCE3____SOURCE4_LIBRPC_NDR_NDR_SPOOLSS_BUF_H__
    225#define ___SPACE_SRC_SAMBA_SOURCES_SAMBA_GIT_SOURCE3____SOURCE4_LIBRPC_NDR_NDR_SPOOLSS_BUF_H__
     
    1538enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r);
    1639enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r);
    17 uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info);
     40uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info);
    1841enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r);
    1942enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r);
    20 uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_JobInfo *info);
     43uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_JobInfo *info);
    2144enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r);
    2245enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r);
    23 uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_DriverInfo *info);
     46uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_DriverInfo *info);
    2447enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r);
    2548enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r);
    26 uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_FormInfo *info);
     49uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_FormInfo *info);
    2750enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r);
    2851enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r);
    29 uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PortInfo *info);
     52uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PortInfo *info);
    3053enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r);
    3154enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r);
    32 uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info);
     55uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info);
    3356enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r);
    3457enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r);
    35 uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
     58uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx,
    3659                                                   uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info);
    3760enum ndr_err_code ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcDataTypes *r);
    3861enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcDataTypes *r);
    39 uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
     62uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx,
    4063                                                      uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info);
    4164enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r);
    4265enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r);
    43 uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
     66uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx,
    4467                                                 uint32_t count, struct spoolss_PrinterEnumValues *info);
    45 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags);
    46 size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags);
     68uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, uint32_t flags);
     69size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, int flags);
    4770_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r);
    4871_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r);
    4972void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r);
    50 size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags);
     73size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, int flags);
    5174void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r);
    5275enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r);
  • trunk/server/librpc/ndr/ndr_table.h

    r414 r745  
     1/*
     2   Unix SMB/CIFS implementation.
     3
     4   dcerpc utility functions
     5
     6   Copyright (C) Andrew Tridgell 2003
     7   Copyright (C) Jelmer Vernooij 2004
     8
     9   This program is free software; you can redistribute it and/or modify
     10   it under the terms of the GNU General Public License as published by
     11   the Free Software Foundation; either version 3 of the License, or
     12   (at your option) any later version.
     13
     14   This program is distributed in the hope that it will be useful,
     15   but WITHOUT ANY WARRANTY; without even the implied warranty of
     16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17   GNU General Public License for more details.
     18
     19   You should have received a copy of the GNU General Public License
     20   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     21*/
     22
    123#ifndef _NDR_TABLE_PROTO_H_
    224#define _NDR_TABLE_PROTO_H_
  • trunk/server/librpc/ndr/ndr_wmi.c

    r414 r745  
    2424#include "librpc/gen_ndr/ndr_dcom.h"
    2525#include "librpc/gen_ndr/ndr_wmi.h"
    26 #include "librpc/ndr/ndr_wmi.h"
    2726
    2827// Just for debugging
     
    3635        enum ndr_err_code status;
    3736        len = strlen(r->data);
    38         if (ndr_flags & NDR_SCALARS) {
    39                 NDR_CHECK(ndr_push_align(ndr, 4));
    40                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x72657355));
    41                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, len));
    42                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2*len));
     37        if (ndr_flags & NDR_SCALARS) {
     38                NDR_CHECK(ndr_push_align(ndr, 4));
     39                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x72657355));
     40                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, len));
     41                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2*len));
    4342                flags = ndr->flags;
    4443                ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NOTERM | LIBNDR_FLAG_STR_SIZE4);
     
    4645                ndr->flags = flags;
    4746                return status;
    48         }
    49         return NDR_ERR_SUCCESS;
     47        }
     48        return NDR_ERR_SUCCESS;
    5049}
    5150
  • trunk/server/librpc/ndr/uuid.c

    r590 r745  
    2626#include "librpc/gen_ndr/ndr_misc.h"
    2727
     28/**
     29  build a NDR blob from a GUID
     30*/
     31_PUBLIC_ NTSTATUS GUID_to_ndr_blob(const struct GUID *guid, TALLOC_CTX *mem_ctx, DATA_BLOB *b)
     32{
     33        enum ndr_err_code ndr_err;
     34        ndr_err = ndr_push_struct_blob(b, mem_ctx, guid,
     35                                       (ndr_push_flags_fn_t)ndr_push_GUID);
     36        return ndr_map_error2ntstatus(ndr_err);
     37}
     38
    2839
    2940/**
     
    3849        NT_STATUS_HAVE_NO_MEMORY(mem_ctx);
    3950
    40         ndr_err = ndr_pull_struct_blob_all(b, mem_ctx, NULL, guid,
     51        ndr_err = ndr_pull_struct_blob_all(b, mem_ctx, guid,
    4152                                           (ndr_pull_flags_fn_t)ndr_pull_GUID);
    4253        talloc_free(mem_ctx);
     
    6475        }
    6576
    66         if (s->length == 36) {
     77        switch(s->length) {
     78        case 36:
     79        {
    6780                TALLOC_CTX *mem_ctx;
    6881                const char *string;
     
    8093                }
    8194                talloc_free(mem_ctx);
    82 
    83         } else if (s->length == 38) {
     95                break;
     96        }
     97        case 38:
     98        {
    8499                TALLOC_CTX *mem_ctx;
    85100                const char *string;
     
    97112                }
    98113                talloc_free(mem_ctx);
    99 
    100         } else if (s->length == 32) {
     114                break;
     115        }
     116        case 32:
     117        {
    101118                size_t rlen = strhex_to_str((char *)blob16.data, blob16.length,
    102119                                            (const char *)s->data, s->length);
     
    108125                return GUID_from_ndr_blob(s, guid);
    109126        }
    110 
    111         if (s->length == 16) {
     127        case 16:
    112128                return GUID_from_ndr_blob(s, guid);
     129        default:
     130                status = NT_STATUS_INVALID_PARAMETER;
     131                break;
    113132        }
    114133
     
    136155        DATA_BLOB blob = data_blob_string_const(s);
    137156        return GUID_from_data_blob(&blob, guid);
    138         return NT_STATUS_OK;
    139157}
    140158
     
    233251{
    234252        if (u1->time_low != u2->time_low) {
    235                 return u1->time_low - u2->time_low;
     253                return u1->time_low > u2->time_low ? 1 : -1;
    236254        }
    237255
    238256        if (u1->time_mid != u2->time_mid) {
    239                 return u1->time_mid - u2->time_mid;
     257                return u1->time_mid > u2->time_mid ? 1 : -1;
    240258        }
    241259
    242260        if (u1->time_hi_and_version != u2->time_hi_and_version) {
    243                 return u1->time_hi_and_version - u2->time_hi_and_version;
     261                return u1->time_hi_and_version > u2->time_hi_and_version ? 1 : -1;
    244262        }
    245263
    246264        if (u1->clock_seq[0] != u2->clock_seq[0]) {
    247                 return u1->clock_seq[0] - u2->clock_seq[0];
     265                return u1->clock_seq[0] > u2->clock_seq[0] ? 1 : -1;
    248266        }
    249267
    250268        if (u1->clock_seq[1] != u2->clock_seq[1]) {
    251                 return u1->clock_seq[1] - u2->clock_seq[1];
     269                return u1->clock_seq[1] > u2->clock_seq[1] ? 1 : -1;
    252270        }
    253271
     
    283301        char *ret;
    284302        DATA_BLOB guid_blob;
    285         enum ndr_err_code ndr_err;
    286303        TALLOC_CTX *tmp_mem;
     304        NTSTATUS status;
    287305
    288306        tmp_mem = talloc_new(mem_ctx);
     
    290308                return NULL;
    291309        }
    292         ndr_err = ndr_push_struct_blob(&guid_blob, tmp_mem,
    293                                        NULL,
    294                                        guid,
    295                                        (ndr_push_flags_fn_t)ndr_push_GUID);
    296         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     310        status = GUID_to_ndr_blob(guid, tmp_mem, &guid_blob);
     311        if (!NT_STATUS_IS_OK(status)) {
    297312                talloc_free(tmp_mem);
    298313                return NULL;
    299314        }
    300315
    301         ret = data_blob_hex_string(mem_ctx, &guid_blob);
     316        ret = data_blob_hex_string_upper(mem_ctx, &guid_blob);
    302317        talloc_free(tmp_mem);
    303318        return ret;
     
    317332}
    318333
    319 _PUBLIC_ bool policy_handle_empty(struct policy_handle *h)
     334_PUBLIC_ bool policy_handle_empty(const struct policy_handle *h)
    320335{
    321336        return (h->handle_type == 0 && GUID_all_zero(&h->uuid));
    322337}
     338
     339_PUBLIC_ bool is_valid_policy_hnd(const struct policy_handle *hnd)
     340{
     341        return !policy_handle_empty(hnd);
     342}
     343
     344_PUBLIC_ bool policy_handle_equal(const struct policy_handle *hnd1,
     345                                  const struct policy_handle *hnd2)
     346{
     347        if (!hnd1 || !hnd2) {
     348                return false;
     349        }
     350
     351        return (memcmp(hnd1, hnd2, sizeof(*hnd1)) == 0);
     352}
  • trunk/server/librpc/ndr_standard.pc.in

    r414 r745  
    88Requires: ndr
    99Version: 0.0.1
    10 Libs: -L${libdir} -lndr-standard
     10Libs: @LIB_RPATH@ -L${libdir} -lndr-standard
    1111Cflags: -I${includedir}  -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1
  • trunk/server/librpc/rpc/binding.c

    r414 r745  
    2424
    2525#include "includes.h"
     26#include "../../lib/util/util_net.h"
    2627#include "librpc/gen_ndr/ndr_epmapper.h"
    2728#include "librpc/gen_ndr/ndr_misc.h"
    2829#include "librpc/rpc/dcerpc.h"
     30#include "rpc_common.h"
     31
    2932#undef strcasecmp
     33#undef strncasecmp
    3034
    3135#define MAX_PROTSEQ             10
     
    8690        {"smb2", DCERPC_SMB2},
    8791        {"hdrsign", DCERPC_HEADER_SIGNING},
    88         {"ndr64", DCERPC_NDR64}
     92        {"ndr64", DCERPC_NDR64},
     93        {"localaddress", DCERPC_LOCALADDRESS}
    8994};
    9095
     
    114119                        } else { /* IPX */
    115120                                return talloc_asprintf(mem_ctx, "IPX:%s",
    116                                                 data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown));
     121                                                data_blob_hex_string_upper(mem_ctx, &epm_floor->rhs.uuid.unknown));
    117122                        }
    118123
     
    220225        for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
    221226                if (b->flags & ncacn_options[i].flag) {
    222                         s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
     227                        if (ncacn_options[i].flag == DCERPC_LOCALADDRESS && b->localaddress) {
     228                                s = talloc_asprintf_append_buffer(s, ",%s=%s", ncacn_options[i].name,
     229                                                                  b->localaddress);
     230                        } else {
     231                                s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
     232                        }
    223233                        if (!s) return NULL;
    224234                }
     
    240250        int i, j, comma_count;
    241251
    242         b = talloc(mem_ctx, struct dcerpc_binding);
     252        b = talloc_zero(mem_ctx, struct dcerpc_binding);
    243253        if (!b) {
    244254                return NT_STATUS_NO_MEMORY;
     
    313323        b->assoc_group_id = 0;
    314324        b->endpoint = NULL;
     325        b->localaddress = NULL;
    315326
    316327        if (!options) {
     
    339350        for (i=0;b->options[i];i++) {
    340351                for (j=0;j<ARRAY_SIZE(ncacn_options);j++) {
    341                         if (strcasecmp(ncacn_options[j].name, b->options[i]) == 0) {
     352                        size_t opt_len = strlen(ncacn_options[j].name);
     353                        if (strncasecmp(ncacn_options[j].name, b->options[i], opt_len) == 0) {
    342354                                int k;
     355                                char c = b->options[i][opt_len];
     356
     357                                if (ncacn_options[j].flag == DCERPC_LOCALADDRESS && c == '=') {
     358                                        b->localaddress = talloc_strdup(b, &b->options[i][opt_len+1]);
     359                                } else if (c != 0) {
     360                                        continue;
     361                                }
     362
    343363                                b->flags |= ncacn_options[j].flag;
    344364                                for (k=i;b->options[k];k++) {
     
    376396        uint16_t if_version=0;
    377397
    378         ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL);
     398        ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx);
    379399        if (ndr == NULL) {
    380400                talloc_free(mem_ctx);
     
    404424static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax)
    405425{
    406         struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL);
     426        DATA_BLOB blob;
     427        struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
    407428
    408429        ndr->flags |= LIBNDR_FLAG_NOALIGN;
     
    411432        ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
    412433
    413         return ndr_push_blob(ndr);
     434        blob = ndr_push_blob(ndr);
     435        talloc_steal(mem_ctx, blob.data);
     436        talloc_free(ndr);
     437        return blob;
     438}
     439
     440static bool dcerpc_floor_pack_rhs_if_version_data(
     441        TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax,
     442        DATA_BLOB *pblob)
     443{
     444        DATA_BLOB blob;
     445        struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
     446        enum ndr_err_code ndr_err;
     447
     448        if (ndr == NULL) {
     449                return false;
     450        }
     451
     452        ndr->flags |= LIBNDR_FLAG_NOALIGN;
     453
     454        ndr_err = ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version >> 16);
     455        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     456                return false;
     457        }
     458
     459        blob = ndr_push_blob(ndr);
     460        talloc_steal(mem_ctx, blob.data);
     461        talloc_free(ndr);
     462        *pblob = blob;
     463        return true;
    414464}
    415465
     
    608658}
    609659
    610 _PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, 
    611                                    struct epm_tower *tower,
    612                                    struct dcerpc_binding **b_out)
     660_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
     661                                            struct epm_tower *tower,
     662                                            struct dcerpc_binding **b_out)
    613663{
    614664        NTSTATUS status;
    615665        struct dcerpc_binding *binding;
    616666
    617         binding = talloc(mem_ctx, struct dcerpc_binding);
     667        /*
     668         * A tower needs to have at least 4 floors to carry useful
     669         * information. Floor 3 is the transport identifier which defines
     670         * how many floors are required at least.
     671         */
     672        if (tower->num_floors < 4) {
     673                return NT_STATUS_INVALID_PARAMETER;
     674        }
     675
     676        binding = talloc_zero(mem_ctx, struct dcerpc_binding);
    618677        NT_STATUS_HAVE_NO_MEMORY(binding);
    619678
     
    631690        }
    632691
    633         if (tower->num_floors < 1) {
    634                 return NT_STATUS_OK;
    635         }
    636 
    637692        /* Set object uuid */
    638693        status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object);
    639694
    640695        if (!NT_STATUS_IS_OK(status)) {
    641                 DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));     
     696                DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));
    642697                return status;
    643698        }
     
    649704        /* Set endpoint */
    650705        if (tower->num_floors >= 4) {
    651                 binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]);
     706                binding->endpoint = dcerpc_floor_get_rhs_data(binding, &tower->floors[3]);
    652707        } else {
    653708                binding->endpoint = NULL;
     
    656711        /* Set network address */
    657712        if (tower->num_floors >= 5) {
    658                 binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]);
     713                binding->host = dcerpc_floor_get_rhs_data(binding, &tower->floors[4]);
    659714                NT_STATUS_HAVE_NO_MEMORY(binding->host);
    660715                binding->target_hostname = binding->host;
     
    662717        *b_out = binding;
    663718        return NT_STATUS_OK;
     719}
     720
     721_PUBLIC_ struct dcerpc_binding *dcerpc_binding_dup(TALLOC_CTX *mem_ctx,
     722                                                   const struct dcerpc_binding *b)
     723{
     724        struct dcerpc_binding *n;
     725        uint32_t count;
     726
     727        n = talloc_zero(mem_ctx, struct dcerpc_binding);
     728        if (n == NULL) {
     729                return NULL;
     730        }
     731
     732        n->transport = b->transport;
     733        n->object = b->object;
     734        n->flags = b->flags;
     735        n->assoc_group_id = b->assoc_group_id;
     736
     737        if (b->host != NULL) {
     738                n->host = talloc_strdup(n, b->host);
     739                if (n->host == NULL) {
     740                        talloc_free(n);
     741                        return NULL;
     742                }
     743        }
     744
     745        if (b->target_hostname != NULL) {
     746                n->target_hostname = talloc_strdup(n, b->target_hostname);
     747                if (n->target_hostname == NULL) {
     748                        talloc_free(n);
     749                        return NULL;
     750                }
     751        }
     752
     753        if (b->target_principal != NULL) {
     754                n->target_principal = talloc_strdup(n, b->target_principal);
     755                if (n->target_principal == NULL) {
     756                        talloc_free(n);
     757                        return NULL;
     758                }
     759        }
     760
     761        if (b->localaddress != NULL) {
     762                n->localaddress = talloc_strdup(n, b->localaddress);
     763                if (n->localaddress == NULL) {
     764                        talloc_free(n);
     765                        return NULL;
     766                }
     767        }
     768
     769        if (b->endpoint != NULL) {
     770                n->endpoint = talloc_strdup(n, b->endpoint);
     771                if (n->endpoint == NULL) {
     772                        talloc_free(n);
     773                        return NULL;
     774                }
     775        }
     776
     777        for (count = 0; b->options && b->options[count]; count++);
     778
     779        if (count > 0) {
     780                uint32_t i;
     781
     782                n->options = talloc_array(n, const char *, count + 1);
     783                if (n->options == NULL) {
     784                        talloc_free(n);
     785                        return NULL;
     786                }
     787
     788                for (i = 0; i < count; i++) {
     789                        n->options[i] = talloc_strdup(n->options, b->options[i]);
     790                        if (n->options[i] == NULL) {
     791                                talloc_free(n);
     792                                return NULL;
     793                        }
     794                }
     795                n->options[count] = NULL;
     796        }
     797
     798        return n;
    664799}
    665800
     
    692827        tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
    693828
    694         tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object);
    695 
    696         tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
     829        tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(tower->floors, &binding->object);
     830
     831        if (!dcerpc_floor_pack_rhs_if_version_data(
     832                    tower->floors, &binding->object,
     833                    &tower->floors[0].rhs.uuid.unknown)) {
     834                return NT_STATUS_NO_MEMORY;
     835        }
    697836
    698837        /* Floor 1 */
    699838        tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
    700839
    701         tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx,
     840        tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(tower->floors,
    702841                                                                &ndr_transfer_syntax);
    703842
    704         tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
     843        tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(tower->floors, 2);
    705844
    706845        /* Floor 2 to num_protocols */
    707846        for (i = 0; i < num_protocols; i++) {
    708847                tower->floors[2 + i].lhs.protocol = protseq[i];
    709                 tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(mem_ctx, NULL, 0);
     848                tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(tower->floors, NULL, 0);
    710849                ZERO_STRUCT(tower->floors[2 + i].rhs);
    711                 dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], "");
     850                dcerpc_floor_set_rhs_data(tower->floors, &tower->floors[2 + i], "");
    712851        }
    713852
    714853        /* The 4th floor contains the endpoint */
    715854        if (num_protocols >= 2 && binding->endpoint) {
    716                 status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint);
     855                status = dcerpc_floor_set_rhs_data(tower->floors, &tower->floors[3], binding->endpoint);
    717856                if (NT_STATUS_IS_ERR(status)) {
    718857                        return status;
     
    722861        /* The 5th contains the network address */
    723862        if (num_protocols >= 3 && binding->host) {
    724                 if (is_ipaddress(binding->host)) {
    725                         status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
     863                if (is_ipaddress(binding->host) ||
     864                    (binding->host[0] == '\\' && binding->host[1] == '\\')) {
     865                        status = dcerpc_floor_set_rhs_data(tower->floors, &tower->floors[4],
    726866                                                           binding->host);
    727867                } else {
     
    731871                           a wildcard all-zeros IP for the server to
    732872                           fill in */
    733                         status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
     873                        status = dcerpc_floor_set_rhs_data(tower->floors, &tower->floors[4],
    734874                                                           "0.0.0.0");
    735875                }
  • trunk/server/librpc/rpc/dcerpc_error.c

    r596 r745  
    2222#include "includes.h"
    2323#include "librpc/rpc/dcerpc.h"
     24#include "rpc_common.h"
    2425
    2526struct dcerpc_fault_table {
     
    3031static const struct dcerpc_fault_table dcerpc_faults[] =
    3132{
    32         { "DCERPC_FAULT_OP_RNG_ERROR",          DCERPC_FAULT_OP_RNG_ERROR },
    33         { "DCERPC_FAULT_UNK_IF",                DCERPC_FAULT_UNK_IF },
    34         { "DCERPC_FAULT_NDR",                   DCERPC_FAULT_NDR },
    35         { "DCERPC_FAULT_INVALID_TAG",           DCERPC_FAULT_INVALID_TAG },
    36         { "DCERPC_FAULT_CONTEXT_MISMATCH",      DCERPC_FAULT_CONTEXT_MISMATCH },
    37         { "DCERPC_FAULT_OTHER",                 DCERPC_FAULT_OTHER },
    38         { "DCERPC_FAULT_ACCESS_DENIED",         DCERPC_FAULT_ACCESS_DENIED },
    39         { "DCERPC_FAULT_SEC_PKG_ERROR",         DCERPC_FAULT_SEC_PKG_ERROR },
    40 
    41         { NULL,                                 0}
     33#define _FAULT_STR(x) { #x , x }
     34        _FAULT_STR(DCERPC_NCA_S_COMM_FAILURE),
     35        _FAULT_STR(DCERPC_NCA_S_OP_RNG_ERROR),
     36        _FAULT_STR(DCERPC_NCA_S_UNKNOWN_IF),
     37        _FAULT_STR(DCERPC_NCA_S_WRONG_BOOT_TIME),
     38        _FAULT_STR(DCERPC_NCA_S_YOU_CRASHED),
     39        _FAULT_STR(DCERPC_NCA_S_PROTO_ERROR),
     40        _FAULT_STR(DCERPC_NCA_S_OUT_ARGS_TOO_BIG),
     41        _FAULT_STR(DCERPC_NCA_S_SERVER_TOO_BUSY),
     42        _FAULT_STR(DCERPC_NCA_S_FAULT_STRING_TOO_LARGE),
     43        _FAULT_STR(DCERPC_NCA_S_UNSUPPORTED_TYPE),
     44        _FAULT_STR(DCERPC_NCA_S_FAULT_INT_DIV_BY_ZERO),
     45        _FAULT_STR(DCERPC_NCA_S_FAULT_ADDR_ERROR),
     46        _FAULT_STR(DCERPC_NCA_S_FAULT_FP_DIV_BY_ZERO),
     47        _FAULT_STR(DCERPC_NCA_S_FAULT_FP_UNDERFLOW),
     48        _FAULT_STR(DCERPC_NCA_S_FAULT_FP_OVERRFLOW),
     49        _FAULT_STR(DCERPC_NCA_S_FAULT_INVALID_TAG),
     50        _FAULT_STR(DCERPC_NCA_S_FAULT_INVALID_BOUND),
     51        _FAULT_STR(DCERPC_NCA_S_FAULT_RPC_VERSION_MISMATCH),
     52        _FAULT_STR(DCERPC_NCA_S_FAULT_UNSPEC_REJECT),
     53        _FAULT_STR(DCERPC_NCA_S_FAULT_BAD_ACTID),
     54        _FAULT_STR(DCERPC_NCA_S_FAULT_WHO_ARE_YOU_FAILED),
     55        _FAULT_STR(DCERPC_NCA_S_FAULT_MANAGER_NOT_ENTERED),
     56        _FAULT_STR(DCERPC_NCA_S_FAULT_CANCEL),
     57        _FAULT_STR(DCERPC_NCA_S_FAULT_ILL_INST),
     58        _FAULT_STR(DCERPC_NCA_S_FAULT_FP_ERROR),
     59        _FAULT_STR(DCERPC_NCA_S_FAULT_INT_OVERFLOW),
     60        _FAULT_STR(DCERPC_NCA_S_UNUSED_1C000011),
     61        _FAULT_STR(DCERPC_NCA_S_FAULT_UNSPEC),
     62        _FAULT_STR(DCERPC_NCA_S_FAULT_REMOTE_COMM_FAILURE),
     63        _FAULT_STR(DCERPC_NCA_S_FAULT_PIPE_EMPTY),
     64        _FAULT_STR(DCERPC_NCA_S_FAULT_PIPE_CLOSED),
     65        _FAULT_STR(DCERPC_NCA_S_FAULT_PIPE_ORDER),
     66        _FAULT_STR(DCERPC_NCA_S_FAULT_PIPE_DISCIPLINE),
     67        _FAULT_STR(DCERPC_NCA_S_FAULT_PIPE_COMM_ERROR),
     68        _FAULT_STR(DCERPC_NCA_S_FAULT_PIPE_MEMORY),
     69        _FAULT_STR(DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH),
     70        _FAULT_STR(DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY),
     71        _FAULT_STR(DCERPC_NCA_S_INVALID_PRES_CONTEXT_ID),
     72        _FAULT_STR(DCERPC_NCA_S_UNSUPPORTED_AUTHN_LEVEL),
     73        _FAULT_STR(DCERPC_NCA_S_UNUSED_1C00001E),
     74        _FAULT_STR(DCERPC_NCA_S_INVALID_CHECKSUM),
     75        _FAULT_STR(DCERPC_NCA_S_INVALID_CRC),
     76        _FAULT_STR(DCERPC_NCA_S_FAULT_USER_DEFINED),
     77        _FAULT_STR(DCERPC_NCA_S_FAULT_TX_OPEN_FAILED),
     78        _FAULT_STR(DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR),
     79        _FAULT_STR(DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND),
     80        _FAULT_STR(DCERPC_NCA_S_FAULT_NO_CLIENT_STUB),
     81        { NULL, 0 }
     82#undef _FAULT_STR
    4283};
    4384
     
    4586{
    4687        int idx = 0;
     88        WERROR werr = W_ERROR(fault_code);
    4789
    4890        while (dcerpc_faults[idx].errstr != NULL) {
     
    5395        }
    5496
    55         return talloc_asprintf(mem_ctx, "DCERPC fault 0x%08x", fault_code);
     97        return win_errstr(werr);
    5698}
     99
     100_PUBLIC_ NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code)
     101{
     102        /* TODO: add more mappings */
     103        switch (fault_code) {
     104        case DCERPC_FAULT_OP_RNG_ERROR:
     105                return NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE;
     106        case DCERPC_FAULT_UNK_IF:
     107                return NT_STATUS_RPC_UNKNOWN_IF;
     108        case DCERPC_FAULT_NDR:
     109                return NT_STATUS_RPC_BAD_STUB_DATA;
     110        case DCERPC_FAULT_INVALID_TAG:
     111                return NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE;
     112        case DCERPC_FAULT_CONTEXT_MISMATCH:
     113                return NT_STATUS_RPC_SS_CONTEXT_MISMATCH;
     114        case DCERPC_FAULT_OTHER:
     115                return NT_STATUS_RPC_CALL_FAILED;
     116        case DCERPC_FAULT_ACCESS_DENIED:
     117                return NT_STATUS_ACCESS_DENIED;
     118        case DCERPC_FAULT_SEC_PKG_ERROR:
     119                return NT_STATUS_RPC_SEC_PKG_ERROR;
     120        }
     121
     122        return NT_STATUS_RPC_PROTOCOL_ERROR;
     123}
     124
  • trunk/server/librpc/tools/ndrdump.1.xml

    r414 r745  
    11<?xml version="1.0" encoding="iso-8859-1"?>
    2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
     2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
    33<refentry id="ndrdump.1">
    44
  • trunk/server/librpc/tools/ndrdump.c

    r414 r745  
    128128}
    129129
     130static void printf_cb(const char *buf, void *private_data)
     131{
     132        printf("%s", buf);
     133}
     134
    130135static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
    131136{
    132         if (force) {
    133                 dump_data(0, d, l);
    134         } else {
    135                 dump_data_skip_zeros(0, d, l);
    136         }
     137        dump_data_cb(d, l, !force, printf_cb, NULL);
     138}
     139
     140static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
     141                                struct ndr_pull *ndr_pull,
     142                                struct ndr_print *ndr_print,
     143                                const struct ndr_interface_call_pipes *pipes)
     144{
     145        NTSTATUS status;
     146        enum ndr_err_code ndr_err;
     147        uint32_t i;
     148
     149        for (i=0; i < pipes->num_pipes; i++) {
     150                uint64_t idx = 0;
     151                while (true) {
     152                        uint32_t *count;
     153                        void *c;
     154                        char *n;
     155
     156                        c = talloc_zero_size(ndr_pull, pipes->pipes[i].chunk_struct_size);
     157                        talloc_set_name(c, "struct %s", pipes->pipes[i].name);
     158                        /*
     159                         * Note: the first struct member is always
     160                         * 'uint32_t count;'
     161                         */
     162                        count = (uint32_t *)c;
     163
     164                        n = talloc_asprintf(c, "%s: %s[%llu]",
     165                                        function, pipes->pipes[i].name,
     166                                        (unsigned long long)idx);
     167
     168                        ndr_err = pipes->pipes[i].ndr_pull(ndr_pull, NDR_SCALARS, c);
     169                        status = ndr_map_error2ntstatus(ndr_err);
     170
     171                        printf("pull returned %s\n", nt_errstr(status));
     172                        if (!NT_STATUS_IS_OK(status)) {
     173                                return status;
     174                        }
     175                        pipes->pipes[i].ndr_print(ndr_print, n, c);
     176
     177                        if (*count == 0) {
     178                                break;
     179                        }
     180                        idx++;
     181                }
     182        }
     183
     184        return NT_STATUS_OK;
    137185}
    138186
     
    172220                { NULL }
    173221        };
    174 
    175         if (DEBUGLEVEL < 1) {
    176                 DEBUGLEVEL = 1;
    177         }
     222        struct ndr_interface_call_pipes *in_pipes = NULL;
     223        struct ndr_interface_call_pipes *out_pipes = NULL;
    178224
    179225        ndr_table_init();
     
    184230        setlinebuf(stdout);
    185231
    186         dbf = x_stderr;
    187 
    188         setup_logging_stdout();
     232        setup_logging("ndrdump", DEBUG_STDOUT);
    189233
    190234        pc = poptGetContext("ndrdump", argc, argv, long_options, 0);
     
    253297        }
    254298
     299        f = find_function(p, function);
     300
    255301        if (strcmp(inout, "in") == 0 ||
    256302            strcmp(inout, "request") == 0) {
    257303                flags = NDR_IN;
     304                in_pipes = &f->in_pipes;
    258305        } else if (strcmp(inout, "out") == 0 ||
    259306                   strcmp(inout, "response") == 0) {
    260307                flags = NDR_OUT;
     308                out_pipes = &f->out_pipes;
    261309        } else {
    262310                printf("Bad inout value '%s'\n", inout);
    263311                exit(1);
    264312        }
    265 
    266         f = find_function(p, function);
    267313
    268314        mem_ctx = talloc_init("ndrdump");
     
    295341                blob.length = size;
    296342
    297                 ndr_pull = ndr_pull_init_blob(&blob, mem_ctx, lp_iconv_convenience(cmdline_lp_ctx));
     343                ndr_pull = ndr_pull_init_blob(&blob, mem_ctx);
    298344                ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
    299345                if (assume_ndr64) {
     
    331377        blob.length = size;
    332378
    333         ndr_pull = ndr_pull_init_blob(&blob, mem_ctx, lp_iconv_convenience(cmdline_lp_ctx));
     379        ndr_pull = ndr_pull_init_blob(&blob, mem_ctx);
    334380        ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
    335381        if (assume_ndr64) {
    336382                ndr_pull->flags |= LIBNDR_FLAG_NDR64;
     383        }
     384
     385        ndr_print = talloc_zero(mem_ctx, struct ndr_print);
     386        ndr_print->print = ndr_print_printf_helper;
     387        ndr_print->depth = 1;
     388
     389        if (out_pipes) {
     390                status = ndrdump_pull_and_print_pipes(function, ndr_pull, ndr_print, out_pipes);
     391                if (!NT_STATUS_IS_OK(status)) {
     392                        printf("dump FAILED\n");
     393                        exit(1);
     394                }
    337395        }
    338396
     
    354412        }
    355413
    356         ndr_print = talloc_zero(mem_ctx, struct ndr_print);
    357         ndr_print->print = ndr_print_debug_helper;
    358         ndr_print->depth = 1;
    359414        f->ndr_print(ndr_print, function, flags, st);
    360415
     
    362417                printf("dump FAILED\n");
    363418                exit(1);
     419        }
     420
     421        if (in_pipes) {
     422                status = ndrdump_pull_and_print_pipes(function, ndr_pull, ndr_print, in_pipes);
     423                if (!NT_STATUS_IS_OK(status)) {
     424                        printf("dump FAILED\n");
     425                        exit(1);
     426                }
    364427        }
    365428
     
    373436                bool differ;
    374437
    375                 ndr_v_push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(cmdline_lp_ctx));
     438                ndr_v_push = ndr_push_init_ctx(mem_ctx);
    376439               
    377440                ndr_err = f->ndr_push(ndr_v_push, flags, st);
     
    390453                }
    391454
    392                 ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx, lp_iconv_convenience(cmdline_lp_ctx));
     455                ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx);
    393456                ndr_v_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
    394457
Note: See TracChangeset for help on using the changeset viewer.