|
|
| version 1.1, 2011/10/04 22:37:46 | version 1.1.1.1.2.2, 2011/10/10 08:55:39 |
|---|---|
| Line 15 icmpTx(sched_task_t *task) | Line 15 icmpTx(sched_task_t *task) |
| { | { |
| struct tagProc *proc; | struct tagProc *proc; |
| int wlen; | int wlen; |
| u_char *str; | |
| FTRACE(3); | FTRACE(3); |
| Line 22 icmpTx(sched_task_t *task) | Line 23 icmpTx(sched_task_t *task) |
| if (!(proc = TASK_ARG(task))) | if (!(proc = TASK_ARG(task))) |
| return (void*) -1; | return (void*) -1; |
| if ((wlen = icmpSend(TASK_FD(task), proc->proc_id, proc->proc_flg, proc->proc_buf_[FD2NET], | if (Crypted) { |
| str = cryptBuffer(proc->proc_buf_[FD2NET], proc->proc_rlen_[FD2NET], Crypted); | |
| if (str) { | |
| memcpy(proc->proc_buf_[FD2NET], str, proc->proc_rlen_[FD2NET]); | |
| free(str); | |
| } | |
| } | |
| if ((wlen = icmpSend(TASK_FD(task), proc->proc_id, proc->proc_flg, Crypted, proc->proc_buf_[FD2NET], | |
| proc->proc_rlen_[FD2NET], &proc->proc_cli, sizeof proc->proc_cli)) != ANSH_FLG_ERR) { | proc->proc_rlen_[FD2NET], &proc->proc_cli, sizeof proc->proc_cli)) != ANSH_FLG_ERR) { |
| proc->proc_flg = ANSH_FLG_OK; | proc->proc_flg = ANSH_FLG_OK; |
| proc->proc_rlen_[FD2NET] = 0; | proc->proc_rlen_[FD2NET] = 0; |
| Line 35 icmpTx(sched_task_t *task) | Line 44 icmpTx(sched_task_t *task) |
| void * | void * |
| icmpRx(sched_task_t *task) | icmpRx(sched_task_t *task) |
| { | { |
| u_char *buf; | u_char *buf, *str; |
| struct sockaddr sa; | struct sockaddr sa; |
| int rlen, n = 0, salen = sizeof sa; | int rlen, n = 0, salen = sizeof sa; |
| struct tagProc *proc = NULL; | struct tagProc *proc = NULL; |
| Line 48 icmpRx(sched_task_t *task) | Line 57 icmpRx(sched_task_t *task) |
| if (!(buf = malloc(rlen))) | if (!(buf = malloc(rlen))) |
| goto end; | goto end; |
| if ((ret = icmpRecv(TASK_FD(task), &id, buf, &rlen, &sa, (socklen_t *) &salen)) == ANSH_FLG_ERR) | if ((ret = icmpRecv(TASK_FD(task), &id, &Crypted, buf, &rlen, &sa, (socklen_t *) &salen)) == ANSH_FLG_ERR) |
| goto end; | goto end; |
| VERB(5) LOG("Received %d bytes", rlen); | VERB(5) LOG("Received %d bytes", rlen); |
| if (!(ret & ANSH_FLG_CPOUT)) | if (!(ret & ANSH_FLG_CPOUT)) |
| Line 66 icmpRx(sched_task_t *task) | Line 75 icmpRx(sched_task_t *task) |
| goto end; | goto end; |
| } | } |
| if (Crypted) { | |
| str = cryptBuffer(buf, rlen, Crypted); | |
| if (str) { | |
| memcpy(buf, str, rlen); | |
| free(str); | |
| } | |
| } | |
| switch (ret) { | switch (ret) { |
| case ANSH_FLG_EOF: | case ANSH_FLG_EOF: |
| case ANSH_FLG_CPOUT: | case ANSH_FLG_CPOUT: |
| Line 246 spawnLogin(sched_task_t *task, struct tagProc *proc) | Line 263 spawnLogin(sched_task_t *task, struct tagProc *proc) |
| if (proc->proc_cli.sa_family == AF_INET) { | if (proc->proc_cli.sa_family == AF_INET) { |
| sin = (struct sockaddr_in*) &proc->proc_cli; | sin = (struct sockaddr_in*) &proc->proc_cli; |
| inet_ntop(AF_INET, &sin->sin_addr, str + 8, INET_ADDRSTRLEN); | inet_ntop(AF_INET, &sin->sin_addr, str + 8, INET_ADDRSTRLEN); |
| } else if (proc->proc_cli.sa_family == AF_INET) { | } else if (proc->proc_cli.sa_family == AF_INET6) { |
| sin6 = (struct sockaddr_in6*) &proc->proc_cli; | sin6 = (struct sockaddr_in6*) &proc->proc_cli; |
| inet_ntop(AF_INET6, &sin6->sin6_addr, str + 8, INET6_ADDRSTRLEN); | inet_ntop(AF_INET6, &sin6->sin6_addr, str + 8, INET6_ADDRSTRLEN); |
| } | } |