00001 /* 00002 * $Id: helpers.h 50 2010-12-02 02:11:46Z julianthome $ 00003 * 00004 * pam_netns - Linux-PAM module for instantiating session network namespaces 00005 * 00006 * Copyright (C) 2010 Wilhelm Meier (wilhelm.meier@fh-kl.de) 00007 * 00008 * This program is free software; you can redistribute it and/or modify it under the terms of 00009 * the GNU General Public License as published by the Free Software Foundation; 00010 * either version 3 of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00013 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00014 * See the GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along with this program; 00017 * if not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00026 #ifndef HELPER_H 00027 #define HELPER_H 00028 00029 #include "common.h" 00030 #include <sys/capability.h> 00031 // needed for def of pam_netns_shm_t 00032 #include "util.h" 00033 #include "pam_netns.h" 00034 00035 #define MAXARGS 31 00036 #define ARGBUFLEN 100 00037 #define MEMORY_INC_STEP 100 00038 00047 char *create_arg(const char *fmt, void **arg); 00048 00056 char **create_argl(const char *fmt, ...); 00057 00064 void sec_free(void **p); 00065 00073 void sec_free_argl(void ***pp); 00074 00082 int sec_close(int *fd); 00083 00091 bool check_caps(void); 00092 00103 int set_file_perm(const char *file_path, uid_t uid, gid_t gid, mode_t mode); 00104 00105 #endif