Ignore:
Timestamp:
Jul 1, 2011, 8:40:10 AM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba 3.5: Update trunk to 3.5.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/librpc/ndr/uuid.c

    r414 r590  
    2626#include "librpc/gen_ndr/ndr_misc.h"
    2727
     28
     29/**
     30  build a GUID from a NDR data blob
     31*/
     32_PUBLIC_ NTSTATUS GUID_from_ndr_blob(const DATA_BLOB *b, struct GUID *guid)
     33{
     34        enum ndr_err_code ndr_err;
     35        TALLOC_CTX *mem_ctx;
     36
     37        mem_ctx = talloc_new(NULL);
     38        NT_STATUS_HAVE_NO_MEMORY(mem_ctx);
     39
     40        ndr_err = ndr_pull_struct_blob_all(b, mem_ctx, NULL, guid,
     41                                           (ndr_pull_flags_fn_t)ndr_pull_GUID);
     42        talloc_free(mem_ctx);
     43        return ndr_map_error2ntstatus(ndr_err);
     44}
     45
     46
    2847/**
    2948  build a GUID from a string
     
    82101                size_t rlen = strhex_to_str((char *)blob16.data, blob16.length,
    83102                                            (const char *)s->data, s->length);
    84                 if (rlen == blob16.length) {
    85                         /* goto the ndr_pull_struct_blob() path */
    86                         status = NT_STATUS_OK;
    87                         s = &blob16;
     103                if (rlen != blob16.length) {
     104                        return NT_STATUS_INVALID_PARAMETER;
    88105                }
     106
     107                s = &blob16;
     108                return GUID_from_ndr_blob(s, guid);
    89109        }
    90110
    91111        if (s->length == 16) {
    92                 enum ndr_err_code ndr_err;
    93                 struct GUID guid2;
    94                 TALLOC_CTX *mem_ctx;
    95 
    96                 mem_ctx = talloc_new(NULL);
    97                 NT_STATUS_HAVE_NO_MEMORY(mem_ctx);
    98 
    99                 ndr_err = ndr_pull_struct_blob(s, mem_ctx, NULL, &guid2,
    100                                                (ndr_pull_flags_fn_t)ndr_pull_GUID);
    101                 talloc_free(mem_ctx);
    102                 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
    103                         return ndr_map_error2ntstatus(ndr_err);
    104                 }
    105                 *guid = guid2;
    106                 return NT_STATUS_OK;
     112                return GUID_from_ndr_blob(s, guid);
    107113        }
    108114
Note: See TracChangeset for help on using the changeset viewer.