您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vstring_free函数代码示例

51自学网 2021-06-03 09:49:17
  C++
这篇教程C++ vstring_free函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中vstring_free函数的典型用法代码示例。如果您正苦于以下问题:C++ vstring_free函数的具体用法?C++ vstring_free怎么用?C++ vstring_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了vstring_free函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

//.........这里部分代码省略.........     * Some sites mistakenly install Postfix sendmail as set-uid root. Drop     * set-uid privileges only when root, otherwise some systems will not     * reset the saved set-userid, which would be a security vulnerability.     */    if (geteuid() == 0 && getuid() != 0) {	msg_warn("the Postfix sendmail command has set-uid root file permissions");	msg_warn("or the command is run from a set-uid root process");	msg_warn("the Postfix sendmail command must be installed without set-uid root file permissions");	set_ugid(getuid(), getgid());    }    /*     * Further initialization. Load main.cf first, so that command-line     * options can override main.cf settings. Pre-scan the argument list so     * that we load the right main.cf file.     */#define GETOPT_LIST "A:B:C:F:GIL:N:O:R:UV:X:b:ce:f:h:imno:p:r:q:tvx"    saved_optind = optind;    while (argv[OPTIND] != 0) {	if (strcmp(argv[OPTIND], "-q") == 0) {	/* not getopt compatible */	    optind++;	    continue;	}	if ((c = GETOPT(argc, argv, GETOPT_LIST)) <= 0)	    break;	if (c == 'C') {	    VSTRING *buf = vstring_alloc(1);	    if (setenv(CONF_ENV_PATH,		   strcmp(sane_basename(buf, optarg), MAIN_CONF_FILE) == 0 ?		       sane_dirname(buf, optarg) : optarg, 1) < 0)		msg_fatal_status(EX_UNAVAILABLE, "out of memory");	    vstring_free(buf);	}    }    optind = saved_optind;    mail_conf_read();    /* Re-evaluate mail_task() after reading main.cf. */    msg_syslog_init(mail_task("sendmail"), LOG_PID, LOG_FACILITY);    get_mail_conf_str_table(str_table);    if (chdir(var_queue_dir))	msg_fatal_status(EX_UNAVAILABLE, "chdir %s: %m", var_queue_dir);    signal(SIGPIPE, SIG_IGN);    /*     * Optionally start the debugger on ourself. This must be done after     * reading the global configuration file, because that file specifies     * what debugger command to execute.     */    if (debug_me)	debug_process();    /*     * The default mode of operation is determined by the process name. It     * can, however, be changed via command-line options (for example,     * "newaliases -bp" will show the mail queue).     */    if (strcmp(argv[0], "mailq") == 0) {	mode = SM_MODE_MAILQ;    } else if (strcmp(argv[0], "newaliases") == 0) {	mode = SM_MODE_NEWALIAS;    } else if (strcmp(argv[0], "smtpd") == 0) {	mode = SM_MODE_DAEMON;
开发者ID:DabeDotCom,项目名称:postfix,代码行数:67,


示例2: main

//.........这里部分代码省略.........    vstring_sprintf(lock_path, "%s/%s.pid", DEF_PID_DIR, var_procname);    if (test_lock && access(vstring_str(lock_path), F_OK) < 0)        exit(0);    lock_fp = open_lock(vstring_str(lock_path), O_RDWR | O_CREAT, 0644, why);    if (test_lock)        exit(lock_fp ? 0 : 1);    if (lock_fp == 0)        msg_fatal("open lock file %s: %s",                  vstring_str(lock_path), vstring_str(why));    vstream_fprintf(lock_fp, "%*lu/n", (int) sizeof(unsigned long) * 4,                    (unsigned long) var_pid);    if (vstream_fflush(lock_fp))        msg_fatal("cannot update lock file %s: %m", vstring_str(lock_path));    close_on_exec(vstream_fileno(lock_fp), CLOSE_ON_EXEC);    /*     * Lock down the Postfix-writable data directory.     */    vstring_sprintf(data_lock_path, "%s/%s.lock", var_data_dir, var_procname);    set_eugid(var_owner_uid, var_owner_gid);    data_lock_fp =        open_lock(vstring_str(data_lock_path), O_RDWR | O_CREAT, 0644, why);    set_ugid(getuid(), getgid());    if (data_lock_fp == 0)        msg_fatal("open lock file %s: %s",                  vstring_str(data_lock_path), vstring_str(why));    vstream_fprintf(data_lock_fp, "%*lu/n", (int) sizeof(unsigned long) * 4,                    (unsigned long) var_pid);    if (vstream_fflush(data_lock_fp))        msg_fatal("cannot update lock file %s: %m", vstring_str(data_lock_path));    close_on_exec(vstream_fileno(data_lock_fp), CLOSE_ON_EXEC);    /*     * Clean up.     */    vstring_free(why);    vstring_free(lock_path);    vstring_free(data_lock_path);    /*     * Optionally start the debugger on ourself.     */    if (debug_me)        debug_process();    /*     * Finish initialization, last part. We must process configuration files     * after processing command-line parameters, so that we get consistent     * results when we SIGHUP the server to reload configuration files.     */    master_config();    master_sigsetup();    master_flow_init();    msg_info("daemon started -- version %s, configuration %s",             var_mail_version, var_config_dir);    /*     * Report successful initialization to the foreground monitor process.     */    if (monitor_fd >= 0) {        write(monitor_fd, "", 1);        (void) close(monitor_fd);    }    /*     * Process events. The event handler will execute the read/write/timer     * action routines. Whenever something has happened, see if we received     * any signal in the mean time. Although the master process appears to do     * multiple things at the same time, it really is all a single thread, so     * that there are no concurrency conflicts within the master process.     */#define MASTER_WATCHDOG_TIME	1000    watchdog = watchdog_create(MASTER_WATCHDOG_TIME, (WATCHDOG_FN) 0, (char *) 0);    for (;;) {#ifdef HAS_VOLATILE_LOCKS        if (myflock(vstream_fileno(lock_fp), INTERNAL_LOCK,                    MYFLOCK_OP_EXCLUSIVE) < 0)            msg_fatal("refresh exclusive lock: %m");        if (myflock(vstream_fileno(data_lock_fp), INTERNAL_LOCK,                    MYFLOCK_OP_EXCLUSIVE) < 0)            msg_fatal("refresh exclusive lock: %m");#endif        watchdog_start(watchdog);		/* same as trigger servers */        event_loop(MASTER_WATCHDOG_TIME / 2);        if (master_gotsighup) {            msg_info("reload -- version %s, configuration %s",                     var_mail_version, var_config_dir);            master_gotsighup = 0;		/* this first */            master_vars_init();			/* then this */            master_refresh();			/* then this */        }        if (master_gotsigchld) {            if (msg_verbose)                msg_info("got sigchld");            master_gotsigchld = 0;		/* this first */            master_reap_child();		/* then this */        }    }}
开发者ID:Gelma,项目名称:Postfix,代码行数:101,


示例3: deliver_alias

//.........这里部分代码省略.........		 * derived from those of the original message.		 * 		 * When delivering to an alias (i.e. the envelope sender is not		 * replaced) any ENVID, RET, or ORCPT parameters are		 * propagated to all forwarding addresses associated with		 * that alias.  The NOTIFY parameter is propagated to the		 * forwarding addresses, except that any SUCCESS keyword is		 * removed.		 */#define DSN_SAVE_UPDATE(saved, old, new) do { /	saved = old; /	old = new; /    } while (0)		DSN_SAVE_UPDATE(dsn_notify, state.msg_attr.rcpt.dsn_notify,				dsn_notify == DSN_NOTIFY_SUCCESS ?				DSN_NOTIFY_NEVER :				dsn_notify & ~DSN_NOTIFY_SUCCESS);		if (canon_owner != 0) {		    DSN_SAVE_UPDATE(dsn_envid, state.msg_attr.dsn_envid, "");		    DSN_SAVE_UPDATE(dsn_ret, state.msg_attr.dsn_ret, 0);		    DSN_SAVE_UPDATE(dsn_orcpt, state.msg_attr.rcpt.dsn_orcpt, "");		    state.msg_attr.rcpt.orig_addr = "";		}		*statusp =		    deliver_token_string(state, usr_attr, saved_alias_result,					 &alias_count);#if 0		if (var_ownreq_special		    && strncmp("owner-", state.msg_attr.sender, 6) != 0		    && alias_count > 10)		    msg_warn("mailing list /"%s/" needs an /"owner-%s/" alias",			     name, name);#endif		if (alias_count < 1) {		    msg_warn("no recipient in alias lookup result for %s", name);		    dsb_simple(state.msg_attr.why, "4.3.0",			       "alias database unavailable");		    *statusp = defer_append(BOUNCE_FLAGS(state.request),					    BOUNCE_ATTR(state.msg_attr));		} else {		    /*		     * XXX DSN		     * 		     * When delivering to a mailing list (i.e. the envelope		     * sender address is replaced) and NOTIFY=SUCCESS was		     * specified, report a DSN of "delivered".		     * 		     * When delivering to an alias (i.e. the envelope sender		     * address is not replaced) and NOTIFY=SUCCESS was		     * specified, report a DSN of "expanded".		     */		    if (dsn_notify & DSN_NOTIFY_SUCCESS) {			state.msg_attr.rcpt.dsn_notify = dsn_notify;			if (canon_owner != 0) {			    state.msg_attr.dsn_envid = dsn_envid;			    state.msg_attr.dsn_ret = dsn_ret;			    state.msg_attr.rcpt.dsn_orcpt = dsn_orcpt;			}			dsb_update(state.msg_attr.why, "2.0.0", canon_owner ?				   "delivered" : "expanded",				   DSB_SKIP_RMTA, DSB_SKIP_REPLY,				   "alias expanded");			(void) trace_append(BOUNCE_FLAG_NONE,					    SENT_ATTR(state.msg_attr));		    }		}	    }	    myfree(saved_alias_result);	    if (owner)		myfree(owner);	    if (canon_owner)		vstring_free(canon_owner);	    if (alias_pwd)		mypwfree(alias_pwd);	    return (YES);	}	/*	 * If the alias database was inaccessible for some reason, defer	 * further delivery for the current top-level recipient.	 */	if (dict_errno != 0) {	    dsb_simple(state.msg_attr.why, "4.3.0",		       "alias database unavailable");	    *statusp = defer_append(BOUNCE_FLAGS(state.request),				    BOUNCE_ATTR(state.msg_attr));	    return (YES);	} else {	    if (msg_verbose)		msg_info("%s: %s: %s not found", myname, *cpp, name);	}    }    /*     * Try delivery to a local user instead.     */    return (NO);}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:101,


示例4: main

int     main(int unused_argc, char **argv){    VSTRING *inbuf = vstring_alloc(1);    char   *bufp;    char   *cmd;    ssize_t cmd_len;    char   *service;    char   *addr;    int     count;    int     rate;    int     msgs;    int     rcpts;    int     newtls;    ANVIL_CLNT *anvil;    msg_vstream_init(argv[0], VSTREAM_ERR);    mail_conf_read();    msg_info("using config files in %s", var_config_dir);    if (chdir(var_queue_dir) < 0)	msg_fatal("chdir %s: %m", var_queue_dir);    msg_verbose++;    anvil = anvil_clnt_create();    while (vstring_fgets_nonl(inbuf, VSTREAM_IN)) {	bufp = vstring_str(inbuf);	if ((cmd = mystrtok(&bufp, " ")) == 0 || *bufp == 0	    || (service = mystrtok(&bufp, " ")) == 0 || *service == 0	    || (addr = mystrtok(&bufp, " ")) == 0 || *addr == 0	    || mystrtok(&bufp, " ") != 0) {	    vstream_printf("bad command syntax/n");	    usage();	    vstream_fflush(VSTREAM_OUT);	    continue;	}	cmd_len = strlen(cmd);	if (strncmp(cmd, ANVIL_REQ_CONN, cmd_len) == 0) {	    if (anvil_clnt_connect(anvil, service, addr, &count, &rate) != ANVIL_STAT_OK)		msg_warn("error!");	    else		vstream_printf("count=%d, rate=%d/n", count, rate);	} else if (strncmp(cmd, ANVIL_REQ_MAIL, cmd_len) == 0) {	    if (anvil_clnt_mail(anvil, service, addr, &msgs) != ANVIL_STAT_OK)		msg_warn("error!");	    else		vstream_printf("rate=%d/n", msgs);	} else if (strncmp(cmd, ANVIL_REQ_RCPT, cmd_len) == 0) {	    if (anvil_clnt_rcpt(anvil, service, addr, &rcpts) != ANVIL_STAT_OK)		msg_warn("error!");	    else		vstream_printf("rate=%d/n", rcpts);	} else if (strncmp(cmd, ANVIL_REQ_NTLS, cmd_len) == 0) {	    if (anvil_clnt_newtls(anvil, service, addr, &newtls) != ANVIL_STAT_OK)		msg_warn("error!");	    else		vstream_printf("rate=%d/n", newtls);	} else if (strncmp(cmd, ANVIL_REQ_NTLS_STAT, cmd_len) == 0) {	    if (anvil_clnt_newtls_stat(anvil, service, addr, &newtls) != ANVIL_STAT_OK)		msg_warn("error!");	    else		vstream_printf("rate=%d/n", newtls);	} else if (strncmp(cmd, ANVIL_REQ_DISC, cmd_len) == 0) {	    if (anvil_clnt_disconnect(anvil, service, addr) != ANVIL_STAT_OK)		msg_warn("error!");	    else		vstream_printf("OK/n");	} else if (strncmp(cmd, ANVIL_REQ_LOOKUP, cmd_len) == 0) {	    if (anvil_clnt_lookup(anvil, service, addr, &count, &rate,				  &msgs, &rcpts, &newtls) != ANVIL_STAT_OK)		msg_warn("error!");	    else		vstream_printf("count=%d, rate=%d msgs=%d rcpts=%d newtls=%d/n",			       count, rate, msgs, rcpts, newtls);	} else {	    vstream_printf("bad command: /"%s/"/n", cmd);	    usage();	}	vstream_fflush(VSTREAM_OUT);    }    vstring_free(inbuf);    anvil_clnt_free(anvil);    return (0);}
开发者ID:Gelma,项目名称:Postfix,代码行数:85,


示例5: deliver_mailbox_file

//.........这里部分代码省略.........     *      * If delivering to the mail spool directory, and the spool directory is     * world-writable, deliver as the recipient; if the spool directory is     * group-writable, use the recipient user id and the mail spool group id.     *      * Otherwise, use root privileges and chown the mailbox.     */    if (spool_dir == 0	|| stat(spool_dir, &st) < 0	|| (st.st_mode & S_IWOTH) != 0) {	spool_uid = usr_attr.uid;	spool_gid = usr_attr.gid;    } else if ((st.st_mode & S_IWGRP) != 0) {	spool_uid = usr_attr.uid;	spool_gid = st.st_gid;    } else {	spool_uid = 0;	spool_gid = 0;    }    if (spool_uid == usr_attr.uid) {	chown_uid = -1;	chown_gid = -1;    } else {	chown_uid = usr_attr.uid;	chown_gid = usr_attr.gid;    }    if (msg_verbose)	msg_info("spool_uid/gid %ld/%ld chown_uid/gid %ld/%ld",		 (long) spool_uid, (long) spool_gid,		 (long) chown_uid, (long) chown_gid);    /*     * Lock the mailbox and open/create the mailbox file. Depending on the     * type of locking used, we lock first or we open first.     *      * Write the file as the recipient, so that file quota work.     */    copy_flags = MAIL_COPY_MBOX;    if ((local_deliver_hdr_mask & DELIVER_HDR_FILE) == 0)	copy_flags &= ~MAIL_COPY_DELIVERED;    set_eugid(spool_uid, spool_gid);    mp = mbox_open(mailbox, O_APPEND | O_WRONLY | O_CREAT,		   S_IRUSR | S_IWUSR, &st, chown_uid, chown_gid,		   local_mbox_lock_mask, "5.2.0", why);    if (mp != 0) {	if (spool_uid != usr_attr.uid || spool_gid != usr_attr.gid)	    set_eugid(usr_attr.uid, usr_attr.gid);	if (S_ISREG(st.st_mode) == 0) {	    vstream_fclose(mp->fp);	    dsb_simple(why, "5.2.0",		       "destination %s is not a regular file", mailbox);	} else if (var_strict_mbox_owner && st.st_uid != usr_attr.uid) {	    vstream_fclose(mp->fp);	    dsb_simple(why, "4.2.0",		       "destination %s is not owned by recipient", mailbox);	    msg_warn("specify /"%s = no/" to ignore mailbox ownership mismatch",		     VAR_STRICT_MBOX_OWNER);	} else {	    end = vstream_fseek(mp->fp, (off_t) 0, SEEK_END);	    mail_copy_status = mail_copy(COPY_ATTR(state.msg_attr), mp->fp,					 copy_flags, "/n", why);	}	if (spool_uid != usr_attr.uid || spool_gid != usr_attr.gid)	    set_eugid(spool_uid, spool_gid);	mbox_release(mp);    }    set_eugid(var_owner_uid, var_owner_gid);    /*     * As the mail system, bounce, defer delivery, or report success.     */    if (mail_copy_status & MAIL_COPY_STAT_CORRUPT) {	deliver_status = DEL_STAT_DEFER;    } else if (mail_copy_status != 0) {	vstring_sprintf_prepend(why->reason,				"cannot update mailbox %s for user %s. ",				mailbox, state.msg_attr.user);	deliver_status =	    (STR(why->status)[0] == '4' ?	     defer_append : bounce_append)	    (BOUNCE_FLAGS(state.request), BOUNCE_ATTR(state.msg_attr));    } else {	dsb_simple(why, "2.0.0", "delivered to mailbox");	deliver_status = sent(BOUNCE_FLAGS(state.request),			      SENT_ATTR(state.msg_attr));	if (var_biff) {	    biff = vstring_alloc(100);	    vstring_sprintf(biff, "%[email
C++ vstring_strcpy函数代码示例
C++ vstring_alloc函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。