check_and_open.c revision 978bea5902ece9b9f01d1d6525dbe0889a410ffc
/*
SSSD
Check file permissions and open file
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2009 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <fcntl.h>
#include <unistd.h>
struct stat *caller_stat_buf)
{
int ret;
struct stat local_stat_buf;
bool type_check;
if (caller_stat_buf == NULL) {
} else {
}
if (ret == -1) {
return errno;
}
switch (type) {
type_check = true;
break;
case CHECK_REG:
break;
case CHECK_DIR:
break;
case CHECK_CHR:
break;
case CHECK_BLK:
break;
case CHECK_FIFO:
break;
case CHECK_LNK:
break;
case CHECK_SOCK:
break;
default:
return EINVAL;
}
if (!type_check) {
return EINVAL;
}
return EINVAL;
}
return EINVAL;
}
return EINVAL;
}
return EOK;
}
enum check_file_type type)
{
int ret;
struct stat fd_stat_buf;
*fd = -1;
return ret;
}
if (*fd == -1) {
return errno;
}
if (ret == -1) {
return errno;
}
*fd = -1;
return EIO;
}
return EOK;
}