README.conffile completed, paranoid_check() used by read_conffiles(),
policy.h will be removed by "make distclean".
This commit is contained in:
parent
8f5ca2eb2b
commit
3beb5afbfa
|
@ -69,7 +69,7 @@ clean:
|
|||
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
|
||||
|
||||
distclean: clean
|
||||
-rm -f .depend
|
||||
-rm -f .depend policy.h
|
||||
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i distclean; done
|
||||
|
||||
install: depend all
|
||||
|
|
|
@ -186,5 +186,50 @@ werden.
|
|||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Funktion:
|
||||
|
||||
section *write_file(section *Section, const char *FileName, char *Program,
|
||||
char* Version)
|
||||
|
||||
Erzeugt eine Datei mit der bekannten Syntax zurueck. Dabei wird ein Datei-
|
||||
header erzeugt.
|
||||
Diese Datei laesst sich auch sehr sinnvoll fuer Debuggingzwecke nutzen.
|
||||
|
||||
|
||||
Section: Beinhaltet den Pointer auf die Struktur, die zurueckgeschrieben
|
||||
wertden soll.
|
||||
|
||||
FileName: Beinhaltet den Dateinamen, in der die Struktur abgelegt werden soll.
|
||||
Besteht diese Datei, wird sie ohne Warnung ueberschrieben.
|
||||
|
||||
Programm: Name des Programm, das diese Datei anlegen soll.
|
||||
|
||||
Version: Version des Programmes, das diese Datei anlegen soll.
|
||||
|
||||
|
||||
Rueckgabewert:
|
||||
|
||||
Bei erfolgreicher Erstellung der Datei wird Section zurueckgeliefert.
|
||||
Im Fehlerfall NULL.
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Funktion:
|
||||
|
||||
void free_section(section *Ptr)
|
||||
|
||||
Loescht eine Section mit ihrer ganzen Unterstruktur. Es wird also die gesamte
|
||||
verkettete Liste (inklusive ihrer Subsections) geloescht.
|
||||
|
||||
Ptr: Pointer auf eine Struktur, die geloescht werden soll.
|
||||
|
||||
|
||||
Rueckgabewert:
|
||||
|
||||
Keiner.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Da noch nicht mehr dokumentiert ist, verweise ich mal frech auf die Dateien
|
||||
lib/conffile.c und vboxgetty/vboxlib.c ;-(((
|
||||
lib/conffile.c ;-(((
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -92,7 +93,7 @@ section *write_file(section *Section, const char *FileName, char *Program, char*
|
|||
Write_Lines(Section,fp,FileName,0);
|
||||
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
return Section;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
@ -158,7 +159,7 @@ static const char *Pre_String(int Level)
|
|||
section *read_file(section *Section, const char *FileName, int Flags)
|
||||
{
|
||||
int Line = 0;
|
||||
FILE *fp;
|
||||
FILE *fp = NULL;
|
||||
section *RetCode = NULL;
|
||||
|
||||
|
||||
|
@ -699,6 +700,54 @@ static int Compare_Sections(section* sec1, section *sec2, char ***variables)
|
|||
|
||||
/****************************************************************************/
|
||||
|
||||
#if 0
|
||||
/* IN PROGRESS!!!!!! */
|
||||
static int Compare_Sections(section* sec1, section *sec2, char **variables)
|
||||
{
|
||||
int i;
|
||||
char **array;
|
||||
|
||||
|
||||
if (sec1 == NULL || sec2 == NULL)
|
||||
return -1;
|
||||
|
||||
if (variables == NULL)
|
||||
{
|
||||
if (!strcmp(sec1->name,sec2->name))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0; variables[i] != NULL; i++)
|
||||
{
|
||||
if ((array = String_to_Array(Path,C_SLASH)) == NULL)
|
||||
return NULL;
|
||||
|
||||
if (Compare_Section_From_Path(sec1,sec2,array) == 0)
|
||||
{
|
||||
del_Array(array);
|
||||
return 0;
|
||||
}
|
||||
|
||||
del_Array(array);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static int Compare_Section_From_Path(section* sec1, section *sec2, char **array)
|
||||
{
|
||||
if (!strcmp(sec1->name,array[0]) &&
|
||||
!strcmp(sec1->name,sec2->name) )
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static int Merge_Sections(section **main_sec, section **ins_sec, char ***variables, int flags)
|
||||
{
|
||||
if (main_sec == NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: isdntools.c,v 1.3 1997/03/06 20:36:34 luethje Exp $
|
||||
/* $Id: isdntools.c,v 1.4 1997/03/07 23:34:49 luethje Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux. (Utilities)
|
||||
*
|
||||
|
@ -19,6 +19,10 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: isdntools.c,v $
|
||||
* Revision 1.4 1997/03/07 23:34:49 luethje
|
||||
* README.conffile completed, paranoid_check() used by read_conffiles(),
|
||||
* policy.h will be removed by "make distclean".
|
||||
*
|
||||
* Revision 1.3 1997/03/06 20:36:34 luethje
|
||||
* Problem in create_runfie() fixed. New function paranoia_check() implemented.
|
||||
*
|
||||
|
@ -652,9 +656,15 @@ int read_conffiles(section **Section, char *groupfile)
|
|||
if (!read_again)
|
||||
{
|
||||
sprintf(s[0], "%s%c%s", confdir(), C_SLASH, CONFFILE);
|
||||
append_element(&files,s[0]);
|
||||
|
||||
sprintf(s[1], "%s%c%s", confdir(), C_SLASH, CALLERIDFILE);
|
||||
|
||||
if (paranoia_check(s[0]))
|
||||
return -1;
|
||||
|
||||
if (paranoia_check(s[1]))
|
||||
return -1;
|
||||
|
||||
append_element(&files,s[0]);
|
||||
append_element(&files,s[1]);
|
||||
|
||||
if (groupfile != NULL)
|
||||
|
@ -723,7 +733,8 @@ int paranoia_check(char *cmd)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (stbuf.st_mode & (S_IWGRP | S_IWOTH))
|
||||
if ((stbuf.st_gid != 0 && (stbuf.st_mode & S_IWGRP)) ||
|
||||
(stbuf.st_mode & S_IWOTH) )
|
||||
{
|
||||
print_msg("File `%s' is writable by group or world!\n", cmd);
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue