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:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/lib/util/tevent_ntstatus.c

    r414 r745  
    2121#include "tevent_ntstatus.h"
    2222
    23 bool tevent_req_nterror(struct tevent_req *req, NTSTATUS status)
     23#define TEVENT_NTERROR_MAGIC (0x917b5acd)
     24
     25bool _tevent_req_nterror(struct tevent_req *req,
     26                         NTSTATUS status,
     27                         const char *location)
    2428{
    25         return tevent_req_error(req, NT_STATUS_V(status));
     29        uint64_t err;
     30
     31        if (NT_STATUS_IS_OK(status)) {
     32                return false;
     33        }
     34
     35        /*
     36         * I've put this variable here, because I'm not 100% certain
     37         * how to correctly assign a 64-bit constant and left-shift it
     38         * by 32 bits in a single expression. If anyone knows, feel
     39         * free :-)
     40         */
     41        err = TEVENT_NTERROR_MAGIC;
     42        err <<= 32;
     43        err |= NT_STATUS_V(status);
     44
     45        return _tevent_req_error(req, err, location);
    2646}
    2747
     
    4262                break;
    4363        case TEVENT_REQ_USER_ERROR:
    44                 *status = NT_STATUS(err);
     64                if ((err >> 32) != TEVENT_NTERROR_MAGIC) {
     65                        abort();
     66                }
     67                *status = NT_STATUS(err & 0xffffffff);
    4568                break;
    4669        default:
     
    6083        return NT_STATUS_OK;
    6184}
     85
     86void tevent_req_simple_finish_ntstatus(struct tevent_req *subreq,
     87                                       NTSTATUS subreq_status)
     88{
     89        struct tevent_req *req = tevent_req_callback_data(
     90                subreq, struct tevent_req);
     91
     92        TALLOC_FREE(subreq);
     93
     94        if (!NT_STATUS_IS_OK(subreq_status)) {
     95                tevent_req_nterror(req, subreq_status);
     96                return;
     97        }
     98        tevent_req_done(req);
     99}
Note: See TracChangeset for help on using the changeset viewer.