Changeset 988 for vendor/current/source3/smbd/message.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/smbd/message.c
r740 r988 24 24 25 25 #include "includes.h" 26 #include "system/filesys.h" 26 27 #include "smbd/smbd.h" 27 28 #include "smbd/globals.h" … … 51 52 fstring alpha_buf; 52 53 char *s; 53 54 if (! (*lp_msg_command())) { 54 mode_t mask; 55 56 if (! (*lp_message_command(frame))) { 55 57 DEBUG(1,("no messaging command specified\n")); 56 58 goto done; … … 62 64 goto done; 63 65 } 66 mask = umask(S_IRWXO | S_IRWXG); 64 67 fd = mkstemp(name); 68 umask(mask); 65 69 66 70 if (fd == -1) { … … 76 80 if (!convert_string_talloc(talloc_tos(), CH_DOS, CH_UNIX, state->msg, 77 81 talloc_get_size(state->msg), (void *)&msg, 78 &len , true)) {82 &len)) { 79 83 DEBUG(3, ("Conversion failed, delivering message in DOS " 80 84 "codepage format\n")); … … 97 101 98 102 /* run the command */ 99 s = talloc_strdup(talloc_tos(), lp_msg_command());103 s = lp_message_command(frame); 100 104 if (s == NULL) { 101 105 goto done; … … 142 146 struct msg_state *state; 143 147 int len; 144 const char*msg;145 const char*p;148 const uint8_t *msg; 149 const uint8_t *p; 146 150 147 151 START_PROFILE(SMBsends); 148 152 149 if (!(*lp_m sg_command())) {153 if (!(*lp_message_command(talloc_tos()))) { 150 154 reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED); 151 155 END_PROFILE(SMBsends); … … 155 159 state = talloc(talloc_tos(), struct msg_state); 156 160 157 p = (const char *)req->buf + 1;161 p = req->buf + 1; 158 162 p += srvstr_pull_req_talloc( 159 163 state, req, &state->from, p, STR_ASCII|STR_TERMINATE) + 1; … … 191 195 void reply_sendstrt(struct smb_request *req) 192 196 { 193 const char *p; 197 struct smbXsrv_connection *xconn = req->xconn; 198 const uint8_t *p; 194 199 195 200 START_PROFILE(SMBsendstrt); 196 201 197 if (!(*lp_m sg_command())) {202 if (!(*lp_message_command(talloc_tos()))) { 198 203 reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED); 199 204 END_PROFILE(SMBsendstrt); … … 201 206 } 202 207 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) { 208 213 reply_nterror(req, NT_STATUS_NO_MEMORY); 209 214 END_PROFILE(SMBsendstrt); … … 211 216 } 212 217 213 p = (const char *)req->buf+1;218 p = req->buf+1; 214 219 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, 216 222 STR_ASCII|STR_TERMINATE) + 1; 217 223 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, 219 226 STR_ASCII|STR_TERMINATE) + 1; 220 227 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)); 223 231 224 232 reply_outbuf(req, 0, 0); … … 235 243 void reply_sendtxt(struct smb_request *req) 236 244 { 245 struct smbXsrv_connection *xconn = req->xconn; 237 246 int len; 238 247 const char *msg; … … 242 251 START_PROFILE(SMBsendtxt); 243 252 244 if (! (*lp_m sg_command())) {253 if (! (*lp_message_command(talloc_tos()))) { 245 254 reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED); 246 255 END_PROFILE(SMBsendtxt); … … 248 257 } 249 258 250 if (( smbd_msg_state == NULL) || (req->buflen < 3)) {259 if ((xconn->smb1.msg_state == NULL) || (req->buflen < 3)) { 251 260 reply_nterror(req, NT_STATUS_INVALID_PARAMETER); 252 261 END_PROFILE(SMBsendtxt); … … 256 265 msg = (const char *)req->buf + 1; 257 266 258 old_len = talloc_get_size( smbd_msg_state->msg);267 old_len = talloc_get_size(xconn->smb1.msg_state->msg); 259 268 260 269 len = MIN(SVAL(msg, 0), smbreq_bufrem(req, msg+2)); 261 270 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); 264 274 265 275 if (tmp == NULL) { … … 269 279 } 270 280 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); 274 284 275 285 DEBUG( 3, ( "SMBsendtxt\n" ) ); … … 288 298 void reply_sendend(struct smb_request *req) 289 299 { 300 struct smbXsrv_connection *xconn = req->xconn; 290 301 START_PROFILE(SMBsendend); 291 302 292 if (! (*lp_m sg_command())) {303 if (! (*lp_message_command(talloc_tos()))) { 293 304 reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED); 294 305 END_PROFILE(SMBsendend); … … 298 309 DEBUG(3,("SMBsendend\n")); 299 310 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); 303 314 304 315 reply_outbuf(req, 0, 0);
Note:
See TracChangeset
for help on using the changeset viewer.