check_and_open.c revision 83bf46f4066e3d5e838a32357c201de9bd6ecdfd
/*
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>
{
int ret;
struct stat local_stat_buf;
if (caller_stat_buf == NULL) {
} else {
}
if (ret == -1) {
return errno;
}
}
struct stat *caller_stat_buf)
{
int ret;
struct stat local_stat_buf;
if (caller_stat_buf == NULL) {
} else {
}
if (ret == -1) {
return errno;
}
}
{
bool type_check;
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;
}
"File has the wrong mode [%.7o], expected [%.7o].\n",
return EINVAL;
}
return EINVAL;
}
return EINVAL;
}
return EOK;
}
enum check_file_type type)
{
int ret;
if (*fd == -1) {
return errno;
}
*fd = -1;
return ret;
}
return EOK;
}