1 /******************************************************************************
2 (c) 2000-2003 Christine Caulfield christine.caulfield@googlemail.com
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 ******************************************************************************/
14
15 #include <sys/types.h>
16 #include <sys/time.h>
17 #include <sys/resource.h>
18 #include <stdio.h>
19 #include <syslog.h>
20 #include <unistd.h>
21 #include <fcntl.h>
22 #include <grp.h>
23 #include <pwd.h>
24 #include <termios.h>
25 #include <string.h>
26 #include <list>
27 #include <queue>
28 #include <string>
29 #include <map>
30 #include <sstream>
31
32 #include "lat.h"
33 #include "utils.h"
34 #include "session.h"
35 #include "localport.h"
36 #include "connection.h"
37 #include "circuit.h"
38 #include "latcpcircuit.h"
39 #include "server.h"
40 #include "serversession.h"
41 #include "reversesession.h"
42
ReverseSession(class LATConnection & p,LAT_SessionStartCmd * cmd,std::string shellcmd,uid_t uid,gid_t gid,unsigned char remid,unsigned char localid,bool clean)43 ReverseSession::ReverseSession(class LATConnection &p,
44 LAT_SessionStartCmd *cmd,
45 std::string shellcmd,
46 uid_t uid, gid_t gid,
47 unsigned char remid,
48 unsigned char localid, bool clean):
49 ServerSession(p, cmd, shellcmd, uid, gid, remid, localid, clean)
50 {
51 }
52
53
new_session(unsigned char * _remote_node,char * service,char * port,unsigned char c)54 int ReverseSession::new_session(unsigned char *_remote_node,
55 char *service, char *port,
56 unsigned char c)
57 {
58 credit = c;
59 strcpy(remote_service, service);
60 strcpy(remote_port, port);
61
62 strcpy(remote_node, (char *)_remote_node);
63
64 // Start local command
65 return create_session(_remote_node);
66 }
67