smbd/message.c

ソースコードを見る。

関数

static void msg_deliver (void)
int reply_sends (connection_struct *conn, char *inbuf, char *outbuf, int dum_size, int dum_buffsize)
int reply_sendstrt (connection_struct *conn, char *inbuf, char *outbuf, int dum_size, int dum_buffsize)
int reply_sendtxt (connection_struct *conn, char *inbuf, char *outbuf, int dum_size, int dum_buffsize)
int reply_sendend (connection_struct *conn, char *inbuf, char *outbuf, int dum_size, int dum_buffsize)

変数

userdom_struct current_user_info
static char msgbuf [1600]
static int msgpos
static fstring msgfrom
static fstring msgto


関数

static void msg_deliver ( void   )  [static]

message.c40 行で定義されています。

参照先 CH_DOSCH_UNIXconvert_string_allocate()current_user_infouserdom_struct::domainerrnofdlenmsgbufmsgfrommsgposmsgtonamepstring_sub()smb_mkstemp()userdom_struct::smb_namesmbrun()standard_sub_basic()tmpdir().

参照元 reply_sendend()reply_sends().

00041 {
00042         pstring name;
00043         int i;
00044         int fd;
00045         char *msg;
00046         int len;
00047         ssize_t sz;
00048 
00049         if (! (*lp_msg_command())) {
00050                 DEBUG(1,("no messaging command specified\n"));
00051                 msgpos = 0;
00052                 return;
00053         }
00054 
00055         /* put it in a temporary file */
00056         slprintf(name,sizeof(name)-1, "%s/msg.XXXXXX",tmpdir());
00057         fd = smb_mkstemp(name);
00058 
00059         if (fd == -1) {
00060                 DEBUG(1,("can't open message file %s\n",name));
00061                 return;
00062         }
00063 
00064         /*
00065          * Incoming message is in DOS codepage format. Convert to UNIX.
00066          */
00067   
00068         if ((len = (int)convert_string_allocate(NULL,CH_DOS, CH_UNIX, msgbuf, msgpos, (void **)(void *)&msg, True)) < 0 || !msg) {
00069                 DEBUG(3,("Conversion failed, delivering message in DOS codepage format\n"));
00070                 for (i = 0; i < msgpos;) {
00071                         if (msgbuf[i] == '\r' && i < (msgpos-1) && msgbuf[i+1] == '\n') {
00072                                 i++;
00073                                 continue;
00074                         }
00075                         sz = write(fd, &msgbuf[i++], 1);
00076                         if ( sz != 1 ) {
00077                                 DEBUG(0,("Write error to fd %d: %ld(%d)\n",fd, (long)sz, errno ));
00078                         }
00079                 }
00080         } else {
00081                 for (i = 0; i < len;) {
00082                         if (msg[i] == '\r' && i < (len-1) && msg[i+1] == '\n') {
00083                                 i++;
00084                                 continue;
00085                         }
00086                         sz = write(fd, &msg[i++],1);
00087                         if ( sz != 1 ) {
00088                                 DEBUG(0,("Write error to fd %d: %ld(%d)\n",fd, (long)sz, errno ));
00089                         }
00090                 }
00091                 SAFE_FREE(msg);
00092         }
00093         close(fd);
00094 
00095         /* run the command */
00096         if (*lp_msg_command()) {
00097                 fstring alpha_msgfrom;
00098                 fstring alpha_msgto;
00099                 pstring s;
00100 
00101                 pstrcpy(s,lp_msg_command());
00102                 pstring_sub(s,"%f",alpha_strcpy(alpha_msgfrom,msgfrom,NULL,sizeof(alpha_msgfrom)));
00103                 pstring_sub(s,"%t",alpha_strcpy(alpha_msgto,msgto,NULL,sizeof(alpha_msgto)));
00104                 standard_sub_basic(current_user_info.smb_name,
00105                                 current_user_info.domain, s, sizeof(s));
00106                 pstring_sub(s,"%s",name);
00107                 smbrun(s,NULL);
00108         }
00109 
00110         msgpos = 0;
00111 }

int reply_sends ( connection_struct conn,
char *  inbuf,
char *  outbuf,
int  dum_size,
int  dum_buffsize 
)

message.c118 行で定義されています。

参照先 lenmsg_deliver()msgbufmsgfrommsgposmsgtoset_message().

00119 {
00120         int len;
00121         char *msg;
00122         int outsize = 0;
00123         char *p;
00124 
00125         START_PROFILE(SMBsends);
00126 
00127         msgpos = 0;
00128 
00129         if (! (*lp_msg_command())) {
00130                 END_PROFILE(SMBsends);
00131                 return(ERROR_DOS(ERRSRV,ERRmsgoff));
00132         }
00133 
00134         outsize = set_message(outbuf,0,0,True);
00135 
00136         p = smb_buf(inbuf)+1;
00137         p += srvstr_pull_buf(inbuf, msgfrom, p, sizeof(msgfrom), STR_ASCII|STR_TERMINATE) + 1;
00138         p += srvstr_pull_buf(inbuf, msgto, p, sizeof(msgto), STR_ASCII|STR_TERMINATE) + 1;
00139 
00140         msg = p;
00141 
00142         len = SVAL(msg,0);
00143         len = MIN(len,sizeof(msgbuf)-msgpos);
00144 
00145         memset(msgbuf,'\0',sizeof(msgbuf));
00146 
00147         memcpy(&msgbuf[msgpos],msg+2,len);
00148         msgpos += len;
00149 
00150         msg_deliver();
00151 
00152         END_PROFILE(SMBsends);
00153         return(outsize);
00154 }

int reply_sendstrt ( connection_struct conn,
char *  inbuf,
char *  outbuf,
int  dum_size,
int  dum_buffsize 
)

message.c161 行で定義されています。

参照先 msgbufmsgfrommsgposmsgtoset_message().

00162 {
00163         int outsize = 0;
00164         char *p;
00165 
00166         START_PROFILE(SMBsendstrt);
00167 
00168         if (! (*lp_msg_command())) {
00169                 END_PROFILE(SMBsendstrt);
00170                 return(ERROR_DOS(ERRSRV,ERRmsgoff));
00171         }
00172 
00173         outsize = set_message(outbuf,1,0,True);
00174 
00175         memset(msgbuf,'\0',sizeof(msgbuf));
00176         msgpos = 0;
00177 
00178         p = smb_buf(inbuf)+1;
00179         p += srvstr_pull_buf(inbuf, msgfrom, p, sizeof(msgfrom), STR_ASCII|STR_TERMINATE) + 1;
00180         p += srvstr_pull_buf(inbuf, msgto, p, sizeof(msgto), STR_ASCII|STR_TERMINATE) + 1;
00181 
00182         DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", msgfrom, msgto ) );
00183 
00184         END_PROFILE(SMBsendstrt);
00185         return(outsize);
00186 }

int reply_sendtxt ( connection_struct conn,
char *  inbuf,
char *  outbuf,
int  dum_size,
int  dum_buffsize 
)

message.c193 行で定義されています。

参照先 lenmsgbufmsgposset_message().

00194 {
00195         int len;
00196         int outsize = 0;
00197         char *msg;
00198         START_PROFILE(SMBsendtxt);
00199 
00200         if (! (*lp_msg_command())) {
00201                 END_PROFILE(SMBsendtxt);
00202                 return(ERROR_DOS(ERRSRV,ERRmsgoff));
00203         }
00204 
00205         outsize = set_message(outbuf,0,0,True);
00206 
00207         msg = smb_buf(inbuf) + 1;
00208 
00209         len = SVAL(msg,0);
00210         len = MIN(len,sizeof(msgbuf)-msgpos);
00211 
00212         memcpy(&msgbuf[msgpos],msg+2,len);
00213         msgpos += len;
00214 
00215         DEBUG( 3, ( "SMBsendtxt\n" ) );
00216 
00217         END_PROFILE(SMBsendtxt);
00218         return(outsize);
00219 }

int reply_sendend ( connection_struct conn,
char *  inbuf,
char *  outbuf,
int  dum_size,
int  dum_buffsize 
)

message.c226 行で定義されています。

参照先 msg_deliver()set_message().

00227 {
00228         int outsize = 0;
00229         START_PROFILE(SMBsendend);
00230 
00231         if (! (*lp_msg_command())) {
00232                 END_PROFILE(SMBsendend);
00233                 return(ERROR_DOS(ERRSRV,ERRmsgoff));
00234         }
00235 
00236         outsize = set_message(outbuf,0,0,True);
00237 
00238         DEBUG(3,("SMBsendend\n"));
00239 
00240         msg_deliver();
00241 
00242         END_PROFILE(SMBsendend);
00243         return(outsize);
00244 }


変数

userdom_struct current_user_info

substitute.c29 行で定義されています。

char msgbuf[1600] [static]

message.c31 行で定義されています。

参照元 dbgtext()Debug1()msg_deliver()reply_sends()reply_sendstrt()reply_sendtxt()sys_adminlog().

int msgpos [static]

message.c32 行で定義されています。

参照元 msg_deliver()reply_sends()reply_sendstrt()reply_sendtxt().

fstring msgfrom [static]

message.c33 行で定義されています。

参照元 msg_deliver()reply_sends()reply_sendstrt().

fstring msgto [static]

message.c34 行で定義されています。

参照元 msg_deliver()reply_sends()reply_sendstrt().


Sambaに対してSat Aug 29 21:24:26 2009に生成されました。  doxygen 1.4.7