Some prototype tweaks.

This commit is contained in:
default 2023-06-05 18:22:04 +02:00
parent 65f5173c2a
commit e788a5bf8f
2 changed files with 15 additions and 15 deletions

16
snac.c
View File

@ -22,9 +22,9 @@
#include <sys/time.h>
#include <sys/stat.h>
d_char *srv_basedir = NULL;
d_char *srv_config = NULL;
d_char *srv_baseurl = NULL;
xs_str *srv_basedir = NULL;
xs_dict *srv_config = NULL;
xs_str *srv_baseurl = NULL;
int dbglevel = 0;
@ -48,7 +48,7 @@ int valid_status(int status)
}
d_char *tid(int offset)
xs_str *tid(int offset)
/* returns a time-based Id */
{
struct timeval tv;
@ -82,7 +82,7 @@ int validate_uid(const char *uid)
}
void srv_debug(int level, d_char *str)
void srv_debug(int level, xs_str *str)
/* logs a debug message */
{
if (xs_str_in(str, srv_basedir) != -1) {
@ -99,11 +99,11 @@ void srv_debug(int level, d_char *str)
}
void snac_debug(snac *snac, int level, d_char *str)
void snac_debug(snac *snac, int level, xs_str *str)
/* prints a user debugging information */
{
xs *o_str = str;
d_char *msg = xs_fmt("[%s] %s", snac->uid, o_str);
xs_str *msg = xs_fmt("[%s] %s", snac->uid, o_str);
if (xs_str_in(msg, snac->basedir) != -1) {
/* replace long basedir references with ~ */
@ -114,7 +114,7 @@ void snac_debug(snac *snac, int level, d_char *str)
}
d_char *hash_password(const char *uid, const char *passwd, const char *nonce)
xs_str *hash_password(const char *uid, const char *passwd, const char *nonce)
/* hashes a password */
{
xs *d_nonce = NULL;

14
snac.h
View File

@ -12,9 +12,9 @@
#define ISO_DATE_SPEC "%Y-%m-%dT%H:%M:%SZ"
extern double disk_layout;
extern d_char *srv_basedir;
extern d_char *srv_config;
extern d_char *srv_baseurl;
extern xs_str *srv_basedir;
extern xs_dict *srv_config;
extern xs_str *srv_baseurl;
extern int dbglevel;
@ -23,10 +23,10 @@ extern int dbglevel;
int mkdirx(const char *pathname);
int valid_status(int status);
d_char *tid(int offset);
xs_str *tid(int offset);
double ftime(void);
void srv_debug(int level, d_char *str);
void srv_debug(int level, xs_str *str);
#define srv_log(str) srv_debug(0, str)
int srv_open(char *basedir, int auto_upgrade);
@ -47,12 +47,12 @@ void user_free(snac *snac);
xs_list *user_list(void);
int user_open_by_md5(snac *snac, const char *md5);
void snac_debug(snac *snac, int level, d_char *str);
void snac_debug(snac *snac, int level, xs_str *str);
#define snac_log(snac, str) snac_debug(snac, 0, str)
int validate_uid(const char *uid);
d_char *hash_password(const char *uid, const char *passwd, const char *nonce);
xs_str *hash_password(const char *uid, const char *passwd, const char *nonce);
int check_password(const char *uid, const char *passwd, const char *hash);
void srv_archive(const char *direction, const char *url, xs_dict *req,