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

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/smbd/message.c

    r740 r988  
    2424
    2525#include "includes.h"
     26#include "system/filesys.h"
    2627#include "smbd/smbd.h"
    2728#include "smbd/globals.h"
     
    5152        fstring alpha_buf;
    5253        char *s;
    53 
    54         if (! (*lp_msg_command())) {
     54        mode_t mask;
     55
     56        if (! (*lp_message_command(frame))) {
    5557                DEBUG(1,("no messaging command specified\n"));
    5658                goto done;
     
    6264                goto done;
    6365        }
     66        mask = umask(S_IRWXO | S_IRWXG);
    6467        fd = mkstemp(name);
     68        umask(mask);
    6569
    6670        if (fd == -1) {
     
    7680        if (!convert_string_talloc(talloc_tos(), CH_DOS, CH_UNIX, state->msg,
    7781                                   talloc_get_size(state->msg), (void *)&msg,
    78                                    &len, true)) {
     82                                   &len)) {
    7983                DEBUG(3, ("Conversion failed, delivering message in DOS "
    8084                          "codepage format\n"));
     
    97101
    98102        /* run the command */
    99         s = talloc_strdup(talloc_tos(), lp_msg_command());
     103        s = lp_message_command(frame);
    100104        if (s == NULL) {
    101105                goto done;
     
    142146        struct msg_state *state;
    143147        int len;
    144         const char *msg;
    145         const char *p;
     148        const uint8_t *msg;
     149        const uint8_t *p;
    146150
    147151        START_PROFILE(SMBsends);
    148152
    149         if (!(*lp_msg_command())) {
     153        if (!(*lp_message_command(talloc_tos()))) {
    150154                reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED);
    151155                END_PROFILE(SMBsends);
     
    155159        state = talloc(talloc_tos(), struct msg_state);
    156160
    157         p = (const char *)req->buf + 1;
     161        p = req->buf + 1;
    158162        p += srvstr_pull_req_talloc(
    159163                state, req, &state->from, p, STR_ASCII|STR_TERMINATE) + 1;
     
    191195void reply_sendstrt(struct smb_request *req)
    192196{
    193         const char *p;
     197        struct smbXsrv_connection *xconn = req->xconn;
     198        const uint8_t *p;
    194199
    195200        START_PROFILE(SMBsendstrt);
    196201
    197         if (!(*lp_msg_command())) {
     202        if (!(*lp_message_command(talloc_tos()))) {
    198203                reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED);
    199204                END_PROFILE(SMBsendstrt);
     
    201206        }
    202207
    203         TALLOC_FREE(smbd_msg_state);
    204 
    205         smbd_msg_state = TALLOC_ZERO_P(NULL, struct msg_state);
    206 
    207         if (smbd_msg_state == NULL) {
     208        TALLOC_FREE(xconn->smb1.msg_state);
     209
     210        xconn->smb1.msg_state = talloc_zero(xconn, struct msg_state);
     211
     212        if (xconn->smb1.msg_state == NULL) {
    208213                reply_nterror(req, NT_STATUS_NO_MEMORY);
    209214                END_PROFILE(SMBsendstrt);
     
    211216        }
    212217
    213         p = (const char *)req->buf+1;
     218        p = req->buf+1;
    214219        p += srvstr_pull_req_talloc(
    215                 smbd_msg_state, req, &smbd_msg_state->from, p,
     220                xconn->smb1.msg_state, req,
     221                &xconn->smb1.msg_state->from, p,
    216222                STR_ASCII|STR_TERMINATE) + 1;
    217223        p += srvstr_pull_req_talloc(
    218                 smbd_msg_state, req, &smbd_msg_state->to, p,
     224                xconn->smb1.msg_state, req,
     225                &xconn->smb1.msg_state->to, p,
    219226                STR_ASCII|STR_TERMINATE) + 1;
    220227
    221         DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", smbd_msg_state->from,
    222                     smbd_msg_state->to ) );
     228        DEBUG(3, ("SMBsendstrt (from %s to %s)\n",
     229                  xconn->smb1.msg_state->from,
     230                  xconn->smb1.msg_state->to));
    223231
    224232        reply_outbuf(req, 0, 0);
     
    235243void reply_sendtxt(struct smb_request *req)
    236244{
     245        struct smbXsrv_connection *xconn = req->xconn;
    237246        int len;
    238247        const char *msg;
     
    242251        START_PROFILE(SMBsendtxt);
    243252
    244         if (! (*lp_msg_command())) {
     253        if (! (*lp_message_command(talloc_tos()))) {
    245254                reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED);
    246255                END_PROFILE(SMBsendtxt);
     
    248257        }
    249258
    250         if ((smbd_msg_state == NULL) || (req->buflen < 3)) {
     259        if ((xconn->smb1.msg_state == NULL) || (req->buflen < 3)) {
    251260                reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
    252261                END_PROFILE(SMBsendtxt);
     
    256265        msg = (const char *)req->buf + 1;
    257266
    258         old_len = talloc_get_size(smbd_msg_state->msg);
     267        old_len = talloc_get_size(xconn->smb1.msg_state->msg);
    259268
    260269        len = MIN(SVAL(msg, 0), smbreq_bufrem(req, msg+2));
    261270
    262         tmp = TALLOC_REALLOC_ARRAY(smbd_msg_state, smbd_msg_state->msg,
    263                                    char, old_len + len);
     271        tmp = talloc_realloc(xconn->smb1.msg_state,
     272                             xconn->smb1.msg_state->msg,
     273                             char, old_len + len);
    264274
    265275        if (tmp == NULL) {
     
    269279        }
    270280
    271         smbd_msg_state->msg = tmp;
    272 
    273         memcpy(&smbd_msg_state->msg[old_len], msg+2, len);
     281        xconn->smb1.msg_state->msg = tmp;
     282
     283        memcpy(&xconn->smb1.msg_state->msg[old_len], msg+2, len);
    274284
    275285        DEBUG( 3, ( "SMBsendtxt\n" ) );
     
    288298void reply_sendend(struct smb_request *req)
    289299{
     300        struct smbXsrv_connection *xconn = req->xconn;
    290301        START_PROFILE(SMBsendend);
    291302
    292         if (! (*lp_msg_command())) {
     303        if (! (*lp_message_command(talloc_tos()))) {
    293304                reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED);
    294305                END_PROFILE(SMBsendend);
     
    298309        DEBUG(3,("SMBsendend\n"));
    299310
    300         msg_deliver(smbd_msg_state);
    301 
    302         TALLOC_FREE(smbd_msg_state);
     311        msg_deliver(xconn->smb1.msg_state);
     312
     313        TALLOC_FREE(xconn->smb1.msg_state);
    303314
    304315        reply_outbuf(req, 0, 0);
Note: See TracChangeset for help on using the changeset viewer.