本文整理汇总了C++中conf_get_str函数的典型用法代码示例。如果您正苦于以下问题:C++ conf_get_str函数的具体用法?C++ conf_get_str怎么用?C++ conf_get_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了conf_get_str函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: proxy_http_negotiate
int proxy_http_negotiate (ProxySocket *p, int change)
{
if (p->state == PROXY_STATE_NEW) {
/* we are just beginning the proxy negotiate process,
* so we'll send off the initial bits of the request.
* for this proxy method, it's just a simple HTTP
* request
*/
char *buf, dest[512];
char *username, *password;
sk_getaddr(p->remote_addr, dest, lenof(dest));
buf = dupprintf("CONNECT %s:%i HTTP/1.1\r\nHost: %s:%i\r\n",
dest, p->remote_port, dest, p->remote_port);
sk_write(p->sub_socket, buf, strlen(buf));
sfree(buf);
username = conf_get_str(p->conf, CONF_proxy_username);
password = conf_get_str(p->conf, CONF_proxy_password);
if (username[0] || password[0]) {
char *buf, *buf2;
int i, j, len;
buf = dupprintf("%s:%s", username, password);
len = strlen(buf);
buf2 = snewn(len * 4 / 3 + 100, char);
sprintf(buf2, "Proxy-Authorization: Basic ");
for (i = 0, j = strlen(buf2); i < len; i += 3, j += 4)
base64_encode_atom((unsigned char *)(buf+i),
(len-i > 3 ? 3 : len-i), buf2+j);
strcpy(buf2+j, "\r\n");
sk_write(p->sub_socket, buf2, strlen(buf2));
sfree(buf);
sfree(buf2);
}
开发者ID:Riatre,项目名称:PuTTY,代码行数:35,代码来源:proxy.c
示例2: module_init
static int module_init(void)
{
auth.nonce_expiry = NONCE_EXPIRY;
auth.secret = rand_u64();
conf_get_u32(restund_conf(), "auth_nonce_expiry", &auth.nonce_expiry);
auth.sharedsecret_length = 0;
auth.sharedsecret2_length = 0;
conf_get_str(restund_conf(), "auth_shared", auth.sharedsecret, sizeof(auth.sharedsecret));
auth.sharedsecret_length = strlen(auth.sharedsecret);
conf_get_str(restund_conf(), "auth_shared_rollover", auth.sharedsecret2, sizeof(auth.sharedsecret2));
auth.sharedsecret2_length = strlen(auth.sharedsecret2);
if (auth.sharedsecret_length > 0 || auth.sharedsecret2_length > 0) {
restund_debug("auth: module loaded shared secret lengths %d and %d\n",
auth.sharedsecret_length,
auth.sharedsecret2_length);
}
restund_stun_register_handler(&stun);
restund_debug("auth: module loaded (nonce_expiry=%us)\n",
auth.nonce_expiry);
return 0;
}
开发者ID:AmesianX,项目名称:restund,代码行数:26,代码来源:auth.c
示例3: module_init
static int module_init(void)
{
struct list *vidcodecl = baresip_vidcodecl();
char h264enc[64];
char h264dec[64];
#ifdef USE_X264
debug("avcodec: x264 build %d\n", X264_BUILD);
#else
debug("avcodec: using libavcodec H.264 encoder\n");
#endif
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 10, 0)
avcodec_init();
#endif
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100)
avcodec_register_all();
#endif
if (0 == conf_get_str(conf_cur(), "avcodec_h264dec",
h264dec, sizeof(h264dec))) {
info("avcodec: using h264 decoder by name (%s)\n", h264dec);
avcodec_h264dec = avcodec_find_decoder_by_name(h264dec);
if (!avcodec_h264dec) {
warning("avcodec: h264 decoder not found (%s)\n",
h264dec);
return ENOENT;
}
vidcodec_register(vidcodecl, &h264);
}
else {
if (avcodec_find_decoder(AV_CODEC_ID_H264))
vidcodec_register(vidcodecl, &h264);
}
if (avcodec_find_decoder(AV_CODEC_ID_H263))
vidcodec_register(vidcodecl, &h263);
if (avcodec_find_decoder(AV_CODEC_ID_MPEG4))
vidcodec_register(vidcodecl, &mpg4);
if (0 == conf_get_str(conf_cur(), "avcodec_h264enc",
h264enc, sizeof(h264enc))) {
info("avcodec: using h264 encoder by name (%s)\n", h264enc);
avcodec_h264enc = avcodec_find_encoder_by_name(h264enc);
if (!avcodec_h264enc) {
warning("avcodec: h264 encoder not found (%s)\n",
h264enc);
return ENOENT;
}
}
return 0;
}
开发者ID:Studio-Link,项目名称:baresip,代码行数:59,代码来源:avcodec.c
示例4: x509_crl_init
int
x509_crl_init(void)
{
/*
* XXX I'm not sure if the method to use CRLs in certificate validation
* is valid for OpenSSL versions prior to 0.9.7. For now, simply do not
* support it.
*/
#if OPENSSL_VERSION_NUMBER >= 0x00907000L
char *dirname;
dirname = conf_get_str("X509-certificates", "CRL-directory");
if (!dirname) {
log_print("x509_crl_init: no CRL-directory");
return 0;
}
if (!x509_read_crls_from_dir(x509_cas, dirname)) {
LOG_DBG((LOG_MISC, 10,
"x509_crl_init: x509_read_crls_from_dir failed"));
return 0;
}
#else
LOG_DBG((LOG_CRYPTO, 10, "x509_crl_init: CRL support only "
"with OpenSSL v0.9.7 or later"));
#endif
return 1;
}
开发者ID:appleorange1,项目名称:bitrig,代码行数:27,代码来源:x509.c
示例5: RunConfig
void RunConfig( Conf * conf /*Config * cfg*/ ) {
char b[2048];
char c[180], *cl;
int freecl = FALSE;
BOOL inherit_handles;
STARTUPINFO si;
PROCESS_INFORMATION pi;
HANDLE filemap = NULL;
char bufpass[256] ;
strcpy( bufpass, conf_get_str(conf,CONF_password));
MASKPASS(bufpass);
/*
* Allocate a file-mapping memory chunk for the
* config structure.
*/
SECURITY_ATTRIBUTES sa;
void *p;
int size;
size = conf_serialised_size(conf);
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
filemap = CreateFileMapping(INVALID_HANDLE_VALUE,
&sa,
PAGE_READWRITE,
0, size, NULL);
if (filemap && filemap != INVALID_HANDLE_VALUE) {
p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, size);
if (p) {
conf_serialise(conf, p);
UnmapViewOfFile(p);
}
}
inherit_handles = TRUE;
sprintf(c, "putty &%p:%u", filemap, (unsigned)size);
cl = c;
memset(bufpass,0,strlen(bufpass));//MASKPASS(cfg->password);
GetModuleFileName(NULL, b, sizeof(b) - 1);
si.cb = sizeof(si);
si.lpReserved = NULL;
si.lpDesktop = NULL;
si.lpTitle = NULL;
si.dwFlags = 0;
si.cbReserved2 = 0;
si.lpReserved2 = NULL;
CreateProcess(b, cl, NULL, NULL, inherit_handles,
NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
if (filemap)
CloseHandle(filemap);
if (freecl)
sfree(cl);
}
开发者ID:svn2github,项目名称:kitty,代码行数:60,代码来源:kitty_launcher.c
示例6: sa_reinit
void
sa_reinit(void)
{
struct sa *sa;
char *tag;
int i;
/* For now; only do this if we have the proper tag configured. */
tag = conf_get_str("General", "Renegotiate-on-HUP");
if (!tag)
return;
LOG_DBG((LOG_SA, 30, "sa_reinit: renegotiating active connections"));
/*
* Get phase 2 SAs. Soft expire those without active exchanges. Do
* not touch a phase 2 SA where the soft expiration is not set, ie.
* the SA is not yet established.
*/
for (i = 0; i <= bucket_mask; i++)
for (sa = LIST_FIRST(&sa_tab[i]); sa; sa = LIST_NEXT(sa, link))
if (sa->phase == 2)
if (exchange_lookup_by_name(sa->name,
sa->phase) == 0 && sa->soft_death) {
timer_remove_event(sa->soft_death);
sa_soft_expire(sa);
}
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:28,代码来源:sa.c
示例7: process_subneg
static void process_subneg(Telnet telnet)
{
unsigned char *b, *p, *q;
int var, value, n, bsize;
char *e, *eval, *ekey, *user;
switch (telnet->sb_opt) {
case TELOPT_TSPEED:
if (telnet->sb_len == 1 && telnet->sb_buf[0] == TELQUAL_SEND) {
char *logbuf;
char *termspeed = conf_get_str(telnet->conf, CONF_termspeed);
b = snewn(20 + strlen(termspeed), unsigned char);
b[0] = IAC;
b[1] = SB;
b[2] = TELOPT_TSPEED;
b[3] = TELQUAL_IS;
strcpy((char *)(b + 4), termspeed);
n = 4 + strlen(termspeed);
b[n] = IAC;
b[n + 1] = SE;
telnet->bufsize = sk_write(telnet->s, (char *)b, n + 2);
logevent(telnet->frontend, "server:\tSB TSPEED SEND");
logbuf = dupprintf("client:\tSB TSPEED IS %s", termspeed);
logevent(telnet->frontend, logbuf);
sfree(logbuf);
sfree(b);
} else
开发者ID:carloszamora,项目名称:ch4zilla,代码行数:27,代码来源:TELNET.C
示例8: x509_cert_init
/* Initialize our databases and load our own certificates. */
int
x509_cert_init(void)
{
char *dirname;
x509_hash_init();
/* Process CA certificates we will trust. */
dirname = conf_get_str("X509-certificates", "CA-directory");
if (!dirname) {
log_print("x509_cert_init: no CA-directory");
return 0;
}
/* Free if already initialized. */
if (x509_cas)
X509_STORE_free(x509_cas);
x509_cas = X509_STORE_new();
if (!x509_cas) {
log_print("x509_cert_init: creating new X509_STORE failed");
return 0;
}
if (!x509_read_from_dir(x509_cas, dirname, 0, &n_x509_cas)) {
log_print("x509_cert_init: x509_read_from_dir failed");
return 0;
}
/* Process client certificates we will accept. */
dirname = conf_get_str("X509-certificates", "Cert-directory");
if (!dirname) {
log_print("x509_cert_init: no Cert-directory");
return 0;
}
/* Free if already initialized. */
if (x509_certs)
X509_STORE_free(x509_certs);
x509_certs = X509_STORE_new();
if (!x509_certs) {
log_print("x509_cert_init: creating new X509_STORE failed");
return 0;
}
if (!x509_read_from_dir(x509_certs, dirname, 1, NULL)) {
log_print("x509_cert_init: x509_read_from_dir failed");
return 0;
}
return 1;
}
开发者ID:appleorange1,项目名称:bitrig,代码行数:48,代码来源:x509.c
示例9: custom_get_time_format
static
int
custom_get_time_format(char *s, size_t max)
{
char buff[256];
return copy(s, max, conf_get_str(CONF_FORMAT, buff, sizeof buff, "%R"));
}
开发者ID:tidatida,项目名称:alarmd,代码行数:8,代码来源:ticker.c
示例10: custom_get_timezone
static
int
custom_get_timezone(char *s, size_t max)
{
char buff[256];
conf_get_str(CONF_ZONE, buff, sizeof buff, tz_get());
tz_set(buff);
return copy(s, max, tz_get());
}
开发者ID:tidatida,项目名称:alarmd,代码行数:9,代码来源:ticker.c
示例11: module_init
static int module_init(void)
{
aufilt_register(baresip_aufiltl(), &sndfile);
conf_get_str(conf_cur(), "snd_path", file_path, sizeof(file_path));
info("sndfile: saving files in %s\n", file_path);
return 0;
}
开发者ID:Studio-Link,项目名称:baresip,代码行数:10,代码来源:sndfile.c
示例12: log_writetimestamp
int log_writetimestamp( struct LogContext *ctx ) {
// "%m/%d/%Y %H:%M:%S "
if( strlen(conf_get_str(ctx->conf,CONF_logtimestamp) /*ctx->cfg.logtimestamp*/)==0 ) return 1 ;
char buf[128] = "" ;
if( poss( "%f", conf_get_str(ctx->conf,CONF_logtimestamp) /*ctx->cfg.logtimestamp*/ ) ) {
SYSTEMTIME sysTime ;
GetLocalTime( &sysTime ) ;
t_strftime( buf, 127, conf_get_str(ctx->conf,CONF_logtimestamp) /*ctx->cfg.logtimestamp*/, sysTime ) ;
}
else {
time_t temps = time( 0 ) ;
struct tm tm = * localtime( &temps ) ;
m_strftime( buf, 127, conf_get_str(ctx->conf,CONF_logtimestamp) /*ctx->cfg.logtimestamp*/, &tm ) ;
}
fwrite(buf, 1, strlen(buf), ctx->lgfp);
return 1;
}
开发者ID:svn2github,项目名称:kitty,代码行数:19,代码来源:logging.c
示例13: xyz_StartSending
void xyz_StartSending(Terminal *term)
{
OPENFILENAME fn;
char filenames[32000];
BOOL res;
memset(&fn, 0, sizeof(fn));
memset(filenames, 0, sizeof(filenames));
fn.lStructSize = sizeof(fn);
fn.lpstrFile = filenames;
fn.nMaxFile = sizeof(filenames)-1; // the missing -1 was causing a crash on very long selections
fn.lpstrTitle = "Select files to upload...";
fn.Flags = OFN_ALLOWMULTISELECT | OFN_CREATEPROMPT | OFN_ENABLESIZING | OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
res = GetOpenFileName(&fn);
if (res)
{
char sz_full_params[32767];
char *p, *curparams;
p = filenames;
curparams = sz_full_params;
sz_full_params[0] = 0;
curparams += sprintf(curparams, "%s", conf_get_str(term->conf,CONF_szoptions));
if (*(p+strlen(filenames)+1)==0) {
sprintf(curparams, " \"%s\"", filenames);
} else {
for (;;) {
p=p+strlen(p)+1;
if (*p==0)
break;
curparams += sprintf(curparams, " \"%s\\%s\"", filenames, p);
}
}
if (xyz_SpawnProcess(term, conf_get_str(term->conf,CONF_szcommand), sz_full_params) == 0) {
term->xyz_transfering = 1;
}
}
}
开发者ID:n1992d,项目名称:putty_localconfig_password,代码行数:42,代码来源:winpzmodem.c
示例14: rlogin_startup
static void rlogin_startup(Rlogin rlogin, const char *ruser)
{
char z = 0;
char *p;
sk_write(rlogin->s, &z, 1);
p = conf_get_str(rlogin->conf, CONF_localusername);
sk_write(rlogin->s, p, strlen(p));
sk_write(rlogin->s, &z, 1);
sk_write(rlogin->s, ruser, strlen(ruser));
sk_write(rlogin->s, &z, 1);
p = conf_get_str(rlogin->conf, CONF_termtype);
sk_write(rlogin->s, p, strlen(p));
sk_write(rlogin->s, "/", 1);
p = conf_get_str(rlogin->conf, CONF_termspeed);
sk_write(rlogin->s, p, strspn(p, "0123456789"));
rlogin->bufsize = sk_write(rlogin->s, &z, 1);
rlogin->prompt = NULL;
}
开发者ID:4myPAL,项目名称:PuTTYTray,代码行数:20,代码来源:rlogin.c
示例15: conf_get_str
char *get_remote_username(Conf *conf)
{
char *username = conf_get_str(conf, CONF_username);
if (*username) {
return dupstr(username);
} else if (conf_get_int(conf, CONF_username_from_env)) {
/* Use local username. */
return get_username(); /* might still be NULL */
} else {
return NULL;
}
}
开发者ID:alexeyaa,项目名称:putty-cac,代码行数:12,代码来源:settings.c
示例16: module_init
static int module_init(void)
{
static struct restund_db db = {
.allh = accounts_getall,
.cnth = accounts_count,
.tlogh = NULL,
};
conf_get_str(restund_conf(), "mysql_host", my.host, sizeof(my.host));
conf_get_str(restund_conf(), "mysql_user", my.user, sizeof(my.user));
conf_get_str(restund_conf(), "mysql_pass", my.pass, sizeof(my.pass));
conf_get_str(restund_conf(), "mysql_db", my.db, sizeof(my.db));
conf_get_u32(restund_conf(), "mysql_ser", &my.version);
if (myconnect()) {
restund_error("mysql: %s\n", mysql_error(&my.mysql));
}
restund_db_set_handler(&db);
return 0;
}
开发者ID:AmesianX,项目名称:restund,代码行数:22,代码来源:mysql_ser.c
示例17: proxy_socks5_selectchap
int proxy_socks5_selectchap(Proxy_Socket p)
{
char *username = conf_get_str(p->conf, CONF_proxy_username);
char *password = conf_get_str(p->conf, CONF_proxy_password);
if (username[0] || password[0]) {
char chapbuf[514];
int ulen;
chapbuf[0] = '\x01'; /* Version */
chapbuf[1] = '\x02'; /* Number of attributes sent */
chapbuf[2] = '\x11'; /* First attribute - algorithms list */
chapbuf[3] = '\x01'; /* Only one CHAP algorithm */
chapbuf[4] = '\x85'; /* ...and it's HMAC-MD5, the core one */
chapbuf[5] = '\x02'; /* Second attribute - username */
ulen = strlen(username);
if (ulen > 255)
ulen = 255;
if (ulen < 1)
ulen = 1;
chapbuf[6] = ulen;
memcpy(chapbuf + 7, username, ulen);
sk_write(p->sub_socket, chapbuf, ulen + 7);
p->chap_num_attributes = 0;
p->chap_num_attributes_processed = 0;
p->chap_current_attribute = -1;
p->chap_current_datalen = 0;
p->state = 8;
} else
plug_closing(p->plug,
"Proxy error: Server chose "
"CHAP authentication but we didn't offer it!",
PROXY_ERROR_GENERAL,
0);
return 1;
}
开发者ID:FauxFaux,项目名称:PuTTYTray,代码行数:38,代码来源:cproxy.c
示例18: get_remote_username
// Based on PuTTY's settings.c
char * get_remote_username(Conf * conf)
{
char * username = conf_get_str(conf, CONF_username);
char * result;
if (*username)
{
result = dupstr(username);
}
else
{
result = nullptr;
}
return result;
}
开发者ID:elfmz,项目名称:far2l,代码行数:15,代码来源:PuttyIntf.cpp
示例19: snew
/*
* Called to set up the serial connection.
*
* Returns an error message, or NULL on success.
*
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *serial_init(void *frontend_handle, void **backend_handle,
Conf *conf,
const char *host, int port, char **realhost,
int nodelay, int keepalive)
{
Serial serial;
const char *err;
char *line;
serial = snew(struct serial_backend_data);
*backend_handle = serial;
serial->frontend = frontend_handle;
serial->finished = FALSE;
serial->inbufsize = 0;
bufchain_init(&serial->output_data);
line = conf_get_str(conf, CONF_serline);
{
char *msg = dupprintf("Opening serial device %s", line);
logevent(serial->frontend, msg);
sfree(msg);
}
serial->fd = open(line, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);
if (serial->fd < 0)
return "Unable to open serial port";
cloexec(serial->fd);
err = serial_configure(serial, conf);
if (err)
return err;
*realhost = dupstr(line);
if (!serial_by_fd)
serial_by_fd = newtree234(serial_compare_by_fd);
add234(serial_by_fd, serial);
serial_uxsel_setup(serial);
/*
* Specials are always available.
*/
update_specials_menu(serial->frontend);
return NULL;
}
开发者ID:halcy,项目名称:PuTTY,代码行数:57,代码来源:uxser.c
示例20: logfopen
/*
* Open the log file. Takes care of detecting an already-existing
* file and asking the user whether they want to append, overwrite
* or cancel logging.
*/
void logfopen(void *handle)
{
struct LogContext *ctx = (struct LogContext *)handle;
struct tm tm;
FILE *fp;
int mode;
/* Prevent repeat calls */
if (ctx->state != L_CLOSED)
return;
if (!ctx->logtype)
return;
tm = ltime();
/* substitute special codes in file name */
if (ctx->currlogfilename)
filename_free(ctx->currlogfilename);
ctx->currlogfilename =
xlatlognam(conf_get_filename(ctx->conf, CONF_logfilename),
conf_get_str(ctx->conf, CONF_host),
conf_get_int(ctx->conf, CONF_port), &tm);
#ifdef PERSOPORT
test_dir( /*&*/ctx->currlogfilename ) ;
#endif
fp = f_open(ctx->currlogfilename, "r", FALSE); /* file already present? */
if (fp) {
int logxfovr = conf_get_int(ctx->conf, CONF_logxfovr);
fclose(fp);
if (logxfovr != LGXF_ASK) {
mode = ((logxfovr == LGXF_OVR) ? 2 : 1);
} else
mode = askappend(ctx->frontend, ctx->currlogfilename,
logfopen_callback, ctx);
} else
mode = 2; /* create == overwrite */
if (mode < 0)
ctx->state = L_OPENING;
else
logfopen_callback(ctx, mode); /* open the file */
}
开发者ID:svn2github,项目名称:kitty,代码行数:49,代码来源:logging.c
注:本文中的conf_get_str函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论