这篇教程C++ vstring_strcpy函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vstring_strcpy函数的典型用法代码示例。如果您正苦于以下问题:C++ vstring_strcpy函数的具体用法?C++ vstring_strcpy怎么用?C++ vstring_strcpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vstring_strcpy函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: scache_single_save_deststatic void scache_single_save_dest(SCACHE *scache, int dest_ttl, const char *dest_label, const char *dest_prop, const char *endp_label){ SCACHE_SINGLE *sp = (SCACHE_SINGLE *) scache; const char *myname = "scache_single_save_dest"; int refresh; if (dest_ttl <= 0) msg_panic("%s: bad dest_ttl: %d", myname, dest_ttl); /* * Optimize: reset timer only, if nothing has changed. */ refresh = (SCACHE_SINGLE_DEST_BUSY(sp) && strcmp(STR(sp->dest.dest_label), dest_label) == 0 && strcmp(STR(sp->dest.dest_prop), dest_prop) == 0 && strcmp(STR(sp->dest.endp_label), endp_label) == 0); if (refresh == 0) { vstring_strcpy(sp->dest.dest_label, dest_label); vstring_strcpy(sp->dest.dest_prop, dest_prop); vstring_strcpy(sp->dest.endp_label, endp_label); } event_request_timer(scache_single_expire_dest, (char *) sp, dest_ttl); if (msg_verbose) msg_info("%s: %s -> %s%s", myname, dest_label, endp_label, refresh ? " (refreshed)" : "");}
开发者ID:Gelma,项目名称:Postfix,代码行数:32,
示例2: update_entrystatic void update_entry(const char *new_channel, const char *new_nexthop, const char *rcpt_domain, VSTRING *channel, VSTRING *nexthop){ /* * :[nexthop] means don't change the channel, and don't change the * nexthop unless a non-default nexthop is specified. Thus, a right-hand * side of ":" is the transport table equivalent of a NOOP. */ if (*new_channel == 0) { /* :[nexthop] */ if (*new_nexthop != 0) vstring_strcpy(nexthop, new_nexthop); } /* * transport[:[nexthop]] means change the channel, and reset the nexthop * to the default unless a non-default nexthop is specified. */ else { vstring_strcpy(channel, new_channel); if (*new_nexthop != 0) vstring_strcpy(nexthop, new_nexthop); else if (strcmp(STR(channel), MAIL_SERVICE_ERROR) != 0 && strcmp(STR(channel), MAIL_SERVICE_RETRY) != 0) vstring_strcpy(nexthop, rcpt_domain); else vstring_strcpy(nexthop, "Address is undeliverable"); }}
开发者ID:DabeDotCom,项目名称:postfix,代码行数:30,
示例3: xsasl_dovecot_parse_reply_argsstatic void xsasl_dovecot_parse_reply_args(XSASL_DOVECOT_SERVER *server, char *line, VSTRING *reply, int success){ char *next; if (server->username) { myfree(server->username); server->username = 0; } /* * Note: TAB is part of the Dovecot protocol and must not appear in * legitimate Dovecot usernames, otherwise the protocol would break. */ for (; line != NULL; line = next) { next = split_at(line, '/t'); if (strncmp(line, "user=", 5) == 0) { server->username = mystrdup(line + 5); printable(server->username, '?'); } else if (strncmp(line, "reason=", 7) == 0) { if (!success) { printable(line + 7, '?'); vstring_strcpy(reply, line + 7); } } }}
开发者ID:Jingeun,项目名称:tongsu_smtp,代码行数:28,
示例4: mainint main(int unused_argc, char **unused_argv){ VSTRING *in_buf = vstring_alloc(10); VSTRING *parse_buf = vstring_alloc(10); char *host; char *port; const char *err; while (vstring_fgets_nonl(in_buf, VSTREAM_IN)) { vstream_printf(">> %s/n", STR(in_buf)); vstream_fflush(VSTREAM_OUT); if (*STR(in_buf) == '#') continue; vstring_strcpy(parse_buf, STR(in_buf)); if ((err = host_port(STR(parse_buf), &host, (char *) 0, &port, "default-service")) != 0) { msg_warn("%s in %s", err, STR(in_buf)); } else { vstream_printf("host %s port %s/n", host, port); vstream_fflush(VSTREAM_OUT); } } vstring_free(in_buf); vstring_free(parse_buf); return (0);}
开发者ID:ystk,项目名称:debian-postfix,代码行数:25,
示例5: switchchar *fold_addr(VSTRING *result, const char *addr, int flags){ char *cp; /* * Fold the address as appropriate. */ switch (flags & FOLD_ADDR_ALL) { case FOLD_ADDR_HOST: if ((cp = strrchr(addr, '@')) != 0) { cp += 1; vstring_strncpy(result, addr, cp - addr); casefold_append(result, cp); break; } /* FALLTHROUGH */ case 0: vstring_strcpy(result, addr); break; case FOLD_ADDR_USER: if ((cp = strrchr(addr, '@')) != 0) { casefold_len(result, addr, cp - addr); vstring_strcat(result, cp); break; } /* FALLTHROUGH */ case FOLD_ADDR_USER | FOLD_ADDR_HOST: casefold(result, addr); break; } return (STR(result));}
开发者ID:DabeDotCom,项目名称:postfix,代码行数:32,
示例6: scache_single_find_endpstatic int scache_single_find_endp(SCACHE *scache, const char *endp_label, VSTRING *endp_prop){ SCACHE_SINGLE *sp = (SCACHE_SINGLE *) scache; const char *myname = "scache_single_find_endp"; int fd; if (!SCACHE_SINGLE_ENDP_BUSY(sp)) { if (msg_verbose) msg_info("%s: no endpoint cache: %s", myname, endp_label); return (-1); } if (strcmp(STR(sp->endp.endp_label), endp_label) == 0) { vstring_strcpy(endp_prop, STR(sp->endp.endp_prop)); fd = sp->endp.fd; sp->endp.fd = -1; scache_single_free_endp(sp); if (msg_verbose) msg_info("%s: found: %s fd=%d", myname, endp_label, fd); return (fd); } if (msg_verbose) msg_info("%s: not found: %s", myname, endp_label); return (-1);}
开发者ID:Gelma,项目名称:Postfix,代码行数:25,
示例7: mainint main(int argc, char **argv){ VSTRING *buf = vstring_alloc(100); MAPS *maps; msg_vstream_init(basename(argv[0]), VSTREAM_ERR); if (argc < 3) msg_fatal("usage: %s maptype:mapname address...", argv[0]); maps = maps_create(argv[1], argv[1], DICT_FLAG_FOLD_FIX); mail_params_init(); if (chdir(var_queue_dir) < 0) msg_fatal("chdir(%s): %m", var_queue_dir); argv += 1; msg_verbose = 1; while (--argc && *++argv) { msg_info("-- start %s --", *argv); smtp_map11_external(vstring_strcpy(buf, *argv), maps, 1); msg_info("-- end %s --", *argv); } vstring_free(buf); maps_free(maps); return (0);}
开发者ID:hiroya,项目名称:postfix,代码行数:25,
示例8: vstring_allocchar *sane_dirname(VSTRING *bp, const char *path){ static VSTRING *buf; const char *last; /* * Your buffer or mine? */ if (bp == 0) { bp = buf; if (bp == 0) bp = buf = vstring_alloc(10); } /* * Special case: return "." for null or zero-length input. */ if (path == 0 || *path == 0) return (STR(vstring_strcpy(bp, "."))); /* * Remove trailing '/' characters from input. Return "/" if input is all * '/' characters. */ last = path + strlen(path) - 1; while (*last == '/') { if (last == path) return (STR(vstring_strcpy(bp, "/"))); last--; } /* * This pathname does not end in '/'. Skip to last '/' character if any. */ while (last >= path && *last != '/') last--; if (last < path) /* no '/' */ return (STR(vstring_strcpy(bp, "."))); /* * Strip trailing '/' characters from dirname (not strictly needed). */ while (last > path && *last == '/') last--; return (STR(vstring_strncpy(bp, path, last - path + 1)));}
开发者ID:DabeDotCom,项目名称:postfix,代码行数:47,
示例9: xsasl_dovecot_server_nextstatic int xsasl_dovecot_server_next(XSASL_SERVER *xp, const char *request, VSTRING *reply){ XSASL_DOVECOT_SERVER *server = (XSASL_DOVECOT_SERVER *) xp; if (!is_valid_base64(request)) { vstring_strcpy(reply, "Invalid base64 data in continued response"); return XSASL_AUTH_FAIL; } /* XXX Encapsulate for logging. */ vstream_fprintf(server->impl->sasl_stream, "CONT/t%u/t%s/n", server->last_request_id, request); if (vstream_fflush(server->impl->sasl_stream) == VSTREAM_EOF) { vstring_strcpy(reply, "Connection lost to authentication server"); return XSASL_AUTH_TEMP; } return xsasl_dovecot_handle_reply(server, reply);}
开发者ID:Jingeun,项目名称:tongsu_smtp,代码行数:18,
示例10: xsasl_cyrus_server_firstint xsasl_cyrus_server_first(XSASL_SERVER *xp, const char *sasl_method, const char *init_response, VSTRING *reply){ const char *myname = "xsasl_cyrus_server_first"; XSASL_CYRUS_SERVER *server = (XSASL_CYRUS_SERVER *) xp; char *dec_buffer; unsigned dec_length; unsigned reply_len; unsigned serveroutlen; int sasl_status; SERVEROUT_TYPE serverout = 0; int xsasl_status;#if SASL_VERSION_MAJOR < 2 const char *errstr = 0;#endif#define IFELSE(e1,e2,e3) ((e1) ? (e2) : (e3)) if (msg_verbose) msg_info("%s: sasl_method %s%s%s", myname, sasl_method, IFELSE(init_response, ", init_response ", ""), IFELSE(init_response, init_response, "")); /* * SASL authentication protocol start-up. Process any initial client * response that was sent along in the AUTH command. */ if (init_response) { reply_len = strlen(init_response); VSTRING_RESET(server->decoded); /* Fix 200512 */ VSTRING_SPACE(server->decoded, reply_len); if ((sasl_status = SASL_DECODE64(init_response, reply_len, dec_buffer = STR(server->decoded), vstring_avail(server->decoded), &dec_length)) != SASL_OK) { vstring_strcpy(reply, xsasl_cyrus_strerror(sasl_status)); return (XSASL_AUTH_FORM); } if (msg_verbose) msg_info("%s: decoded initial response %s", myname, dec_buffer); } else { dec_buffer = 0; dec_length = 0; } sasl_status = SASL_SERVER_START(server->sasl_conn, sasl_method, dec_buffer, dec_length, &serverout, &serveroutlen, &errstr); xsasl_status = xsasl_cyrus_server_auth_response(sasl_status, serverout, serveroutlen, reply);#if SASL_VERSION_MAJOR < 2 /* SASL version 1 doesn't free memory that it allocates. */ free(serverout);#endif return (xsasl_status);}
开发者ID:Dexus,项目名称:ubuntu-trusty-postfix,代码行数:57,
示例11: xsasl_dovecot_handle_replystatic int xsasl_dovecot_handle_reply(XSASL_DOVECOT_SERVER *server, VSTRING *reply){ const char *myname = "xsasl_dovecot_handle_reply"; char *line, *cmd; /* XXX Encapsulate for logging. */ while (vstring_get_nonl(server->sasl_line, server->impl->sasl_stream) != VSTREAM_EOF) { line = vstring_str(server->sasl_line); if (msg_verbose) msg_info("%s: auth reply: %s", myname, line); cmd = line; line = split_at(line, '/t'); if (strcmp(cmd, "OK") == 0) { if (xsasl_dovecot_parse_reply(server, &line) == 0) { /* authentication successful */ xsasl_dovecot_parse_reply_args(server, line, reply, 1); return XSASL_AUTH_DONE; } } else if (strcmp(cmd, "CONT") == 0) { if (xsasl_dovecot_parse_reply(server, &line) == 0) { vstring_strcpy(reply, line); return XSASL_AUTH_MORE; } } else if (strcmp(cmd, "FAIL") == 0) { if (xsasl_dovecot_parse_reply(server, &line) == 0) { /* authentication failure */ xsasl_dovecot_parse_reply_args(server, line, reply, 0); return XSASL_AUTH_FAIL; } } else { /* ignore */ } } vstring_strcpy(reply, "Connection lost to authentication server"); return XSASL_AUTH_TEMP;}
开发者ID:Jingeun,项目名称:tongsu_smtp,代码行数:42,
示例12: returnconst char *check_user_acl_byuid(char *acl, uid_t uid){ struct mypasswd *mypwd; STRING_LIST *list; static VSTRING *who = 0; int matched; const char *name; /* * Optimize for the most common case. This also makes Postfix a little * more robust in the face of local infrastructure failures. Note that we * only need to match the "static:" substring, not the result value. */ if (strncmp(acl, DICT_TYPE_STATIC ":", sizeof(DICT_TYPE_STATIC)) == 0) return (0); /* * XXX: Substitute "unknown" for UIDs without username, so that * static:anyone results in "permit" even when the uid is not found in * the password file, and so that a pattern of !unknown can be used to * block non-existent accounts. * * The alternative is to use the UID as a surrogate lookup key for * non-existent accounts. There are several reasons why this is not a * good idea. 1) An ACL with a numerical UID should work regardless of * whether or not an account has a password file entry. Therefore we * would always have search on the numerical UID whenever the username * fails to produce a match. 2) The string-list infrastructure is not * really suitable for mixing numerical and non-numerical user * information, because the numerical match is done in a separate pass * from the non-numerical match. This breaks when the ! operator is used. * * XXX To avoid waiting until the lookup completes (e.g., LDAP or NIS down) * invoke mypwuid_err(), and either change the user_acl() API to * propagate the error to the caller, or treat lookup errors as fatal. */ if ((mypwd = mypwuid(uid)) == 0) { name = "unknown"; } else { name = mypwd->pw_name; } list = string_list_init(MATCH_FLAG_NONE, acl); if ((matched = string_list_match(list, name)) == 0) { if (!who) who = vstring_alloc(10); vstring_strcpy(who, name); } string_list_free(list); if (mypwd) mypwfree(mypwd); return (matched ? 0 : vstring_str(who));}
开发者ID:Gelma,项目名称:Postfix,代码行数:54,
示例13: cleanup_addr_sendervoid cleanup_addr_sender(CLEANUP_STATE *state, const char *buf){ VSTRING *clean_addr = vstring_alloc(100); const char *bcc; /* * Note: an unqualified envelope address is for all practical purposes * equivalent to a fully qualified local address, both for delivery and * for replying. Having to support both forms is error prone, therefore * an incomplete envelope address is rewritten to fully qualified form in * the local domain context. * * 20000520: Replace [email C++ vswprintf函数代码示例 C++ vstring_free函数代码示例
|