OpenDNSSEC-signer
1.4.1
|
#include "config.h"
#include "shared/status.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
Go to the source code of this file.
Macros | |
#define | SYSTEM_MAXLEN 1024 |
Functions | |
const char * | ods_file_mode2str (const char *mode) |
int | ods_fgetc (FILE *fd, unsigned int *line_nr) |
int | ods_skip_whitespace (FILE *fd, unsigned int *line_nr) |
char * | ods_build_path (const char *file, const char *suffix, int dir, int no_slash) |
FILE * | ods_fopen (const char *file, const char *dir, const char *mode) |
void | ods_fclose (FILE *fd) |
ssize_t | ods_writen (int fd, const void *vptr, size_t n) |
time_t | ods_file_lastmodified (const char *file) |
int | ods_strcmp (const char *s1, const char *s2) |
int | ods_strlowercmp (const char *s1, const char *s2) |
const char * | ods_replace (const char *str, const char *oldstr, const char *newstr) |
char * | ods_dir_name (const char *file) |
ods_status | ods_file_copy (const char *file1, const char *file2) |
void | ods_chown (const char *file, uid_t uid, gid_t gid, int getdir) |
void | ods_str_trim (char *str) |
void | ods_str_list_add (char ***list, char *str) |
#define SYSTEM_MAXLEN 1024 |
char* ods_build_path | ( | const char * | file, |
const char * | suffix, | ||
int | dir, | ||
int | no_slash | ||
) |
Construct file or directory name.
[in] | file | filename without extension |
[in] | suffix | extension. |
[in] | dir | directory or not |
[in] | no_slash | no forward slashes and such characters allowed |
Construct file name. (StrAppend?, snprintf?)
Definition at line 126 of file file.c.
References ods_log_crit().
Referenced by addns_read(), addns_write(), adfile_write(), axfr(), ixfr(), zone_backup2(), and zone_recover2().
void ods_chown | ( | const char * | file, |
uid_t | uid, | ||
gid_t | gid, | ||
int | getdir | ||
) |
(Create) and change ownership of directories.
[in] | file | file name |
[in] | uid | user id |
[in] | gid | group id |
[in] | getdir | fetch directory part |
(Create) and change ownership of directories
Definition at line 497 of file file.c.
References ods_dir_name(), ods_log_debug(), ods_log_error(), and ods_log_warning().
char* ods_dir_name | ( | const char * | file | ) |
Get directory part of filename.
[in] | file | file name |
Get directory part of filename.
Definition at line 466 of file file.c.
References ods_log_assert.
Referenced by ods_chown().
void ods_fclose | ( | FILE * | fd | ) |
Close a file.
[in] | fd | the file descriptor |
Close a file.
Definition at line 243 of file file.c.
Referenced by addns_read(), addns_write(), adfile_read(), adfile_write(), axfr(), engine_config(), ixfr(), ods_file_lastmodified(), ods_log_init(), util_write_pidfile(), zone_backup2(), and zone_recover2().
int ods_fgetc | ( | FILE * | fd, |
unsigned int * | line_nr | ||
) |
Get next character.
[in] | fd | file descriptor |
[in] | line_nr | line number |
Get next char.
Definition at line 80 of file file.c.
References ods_log_assert, and ods_log_crit().
Referenced by adutil_readline_frm_file(), and ods_skip_whitespace().
ods_status ods_file_copy | ( | const char * | file1, |
const char * | file2 | ||
) |
Copy file.
[in] | file1 | from file name |
[in] | file2 | to file name |
File copy.
Definition at line 423 of file file.c.
References BUFFER_SIZE, ODS_STATUS_ASSERT_ERR, ODS_STATUS_FOPEN_ERR, ODS_STATUS_FREAD_ERR, ODS_STATUS_FWRITE_ERR, and ODS_STATUS_OK.
time_t ods_file_lastmodified | ( | const char * | file | ) |
Get file status.
[in] | file | file name |
Get file last modified.
Definition at line 285 of file file.c.
References ods_fclose(), ods_fopen(), ods_log_assert, and ods_log_error().
Referenced by signconf_update(), and zonelist_update().
const char* ods_file_mode2str | ( | const char * | mode | ) |
Convert file mode to readable string.
[in] | mode | file mode |
Convert file mode to readable string.
Definition at line 58 of file file.c.
References ods_strcmp().
Referenced by ods_fopen().
FILE* ods_fopen | ( | const char * | file, |
const char * | dir, | ||
const char * | mode | ||
) |
Open a file.
[in] | file | filename. |
[in] | dir | directory. |
[in] | mode | file mode |
Open a file.
Definition at line 186 of file file.c.
References ods_file_mode2str(), ods_log_assert, ods_log_debug(), ods_log_deeebug(), and ods_log_error().
Referenced by addns_read(), addns_write(), adfile_read(), adfile_write(), axfr(), engine_config(), ixfr(), ods_file_lastmodified(), ods_log_init(), util_write_pidfile(), zone_backup2(), and zone_recover2().
const char* ods_replace | ( | const char * | str, |
const char * | oldstr, | ||
const char * | newstr | ||
) |
Replace a substring in string.
[in] | str | The string |
[in] | oldstr | old substring |
[in] | newstr | new substring |
Replace a substring in string.
Definition at line 366 of file file.c.
References SYSTEM_MAXLEN.
int ods_skip_whitespace | ( | FILE * | fd, |
unsigned int * | line_nr | ||
) |
Skip white space.
[in] | fd | file descriptor |
[in] | line_nr | line number |
Skip white space.
Definition at line 104 of file file.c.
References ods_fgetc(), and ods_log_assert.
void ods_str_list_add | ( | char *** | list, |
char * | str | ||
) |
Add a string to a list of strings. Taken from ods-enforcer.
[out] | list | string list |
[in] | str | string to add |
Add a string to a list of strings. Taken from ods-enforcer.
List is NULL, allocate new
Definition at line 572 of file file.c.
References ods_fatal_exit().
void ods_str_trim | ( | char * | str | ) |
int ods_strcmp | ( | const char * | s1, |
const char * | s2 | ||
) |
Compare strings.
[in] | s1 | one string |
[in] | s2 | another string |
Compare strings.
Definition at line 312 of file file.c.
Referenced by adapter_compare(), addns_read_rr(), backup_read_check_str(), keylist_lookup_by_locator(), main(), namedb_update_serial(), ods_file_mode2str(), parse_zonelist_zones(), signconf_compare_denial(), zone_merge(), and zone_recover2().
int ods_strlowercmp | ( | const char * | str1, |
const char * | str2 | ||
) |
Compare strings lowercased.
[in] | s1 | one string |
[in] | s2 | another string |
Compare a string lowercased
Definition at line 334 of file file.c.
Referenced by tsig_lookup_algo(), and tsig_lookup_by_name().