Move fileops.c defines and prototypes to filesops.h

This commit is contained in:
Todd C. Miller
2010-04-23 06:02:39 -04:00
parent f7f9def5ef
commit 4b04e875ed
4 changed files with 40 additions and 29 deletions

31
include/fileops.h Normal file
View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _SUDO_FILEOPS_H
#define _SUDO_FILEOPS_H
/*
* Flags for lock_file()
*/
#define SUDO_LOCK 1 /* lock a file */
#define SUDO_TLOCK 2 /* test & lock a file (non-blocking) */
#define SUDO_UNLOCK 4 /* unlock a file */
int lock_file(int, int);
int touch(int, char *, struct timeval *);
char *sudo_parseln(FILE *);
#endif /* _SUDO_FILEOPS_H */

View File

@@ -28,6 +28,7 @@
#include <error.h>
#include <alloc.h>
#include <list.h>
#include <fileops.h>
#include <missing.h>
#include "defaults.h"
#include "logging.h"
@@ -186,13 +187,6 @@ struct sudo_user {
*/
#define SUDO_PASS_MAX 256
/*
* Flags for lock_file()
*/
#define SUDO_LOCK 1 /* lock a file */
#define SUDO_TLOCK 2 /* test & lock a file (non-blocking) */
#define SUDO_UNLOCK 4 /* unlock a file */
struct lbuf;
struct passwd;
@@ -256,11 +250,6 @@ YY_DECL;
void dump_defaults(void);
void dump_auth_methods(void);
/* fileops.c */
int lock_file(int, int);
int touch(int, char *, struct timeval *);
char *sudo_parseln(FILE *);
/* getspwuid.c */
char *sudo_getepw(const struct passwd *);

View File

@@ -47,7 +47,7 @@
# include <emul/timespec.h>
#endif
#include "sudo.h" /* XXX - for SUDO_LOCK and friends */
#include <fileops.h>
#ifndef LINE_MAX
# define LINE_MAX 2048

View File

@@ -26,11 +26,13 @@
#include <pathnames.h>
#include <limits.h>
#include "compat.h"
#include "alloc.h"
#include "error.h"
#include "list.h"
#include "missing.h"
#include <compat.h>
#include <alloc.h>
#include <error.h>
#include <fileops.h>
#include <list.h>
#include <missing.h>
#ifdef __TANDEM
# define ROOT_UID 65535
@@ -93,13 +95,6 @@
*/
#define SUDO_PASS_MAX 256
/*
* Flags for lock_file()
*/
#define SUDO_LOCK 1 /* lock a file */
#define SUDO_TLOCK 2 /* test & lock a file (non-blocking) */
#define SUDO_UNLOCK 4 /* unlock a file */
/*
* Flags for tgetpass()
*/
@@ -173,10 +168,6 @@ int tty_present(void);
/* zero_bytes.c */
void zero_bytes(volatile void *, size_t);
/* fileops.c */
int lock_file(int, int);
char *sudo_parseln(FILE *);
/* script.c */
int script_duplow(int);
int script_execve(struct command_details *details, char *argv[], char *envp[],