/ src / shellspawn / shellspawn.h
shellspawn.h
 1  /*
 2  This file is part of Darling.
 3  
 4  Copyright (C) 2017 Lubos Dolezel
 5  
 6  Darling is free software: you can redistribute it and/or modify
 7  it under the terms of the GNU General Public License as published by
 8  the Free Software Foundation, either version 3 of the License, or
 9  (at your option) any later version.
10  
11  Darling is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15  
16  You should have received a copy of the GNU General Public License
17  along with Darling.  If not, see <http://www.gnu.org/licenses/>.
18  */
19  
20  #ifndef _SHELLSPAWN_H
21  #define _SHELLSPAWN_H
22  
23  #ifdef TESTING
24  #define SHELLSPAWN_SOCKPATH "/tmp/shellspawn.sock"
25  #else
26  #define SHELLSPAWN_SOCKPATH "/var/run/shellspawn.sock"
27  #endif
28  
29  typedef unsigned short shellspawn_cmd_type_t;
30  
31  enum {
32  	SHELLSPAWN_ADDARG = 1, // add shell argument
33  	SHELLSPAWN_SETENV, // add env variable string
34  	SHELLSPAWN_CHDIR,
35  	SHELLSPAWN_GO, // execute the shell/executable now, must also contain file descriptors
36  	SHELLSPAWN_SIGNAL, // pass a signal from client
37  	SHELLSPAWN_SETUIDGID, // set virtual uid and gid
38  	SHELLSPAWN_SETEXEC, // set the executable to spawn (instead of a shell). must be given before any ADDARG commands.
39  };
40  
41  struct __attribute__((packed)) shellspawn_cmd
42  {
43  	shellspawn_cmd_type_t cmd;
44  	unsigned short data_length;
45  	char data[];
46  };
47  
48  #endif
49