• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ printable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: convertToHighest

std::string Timer::approximateTimeLeft(std::string name, double percentage) const {
    TimeTypes::TimerList::const_iterator it = timers.find(name);
    std::ostringstream ss;
    ss.precision(3);

    if (it != timers.end()) {
        double time = it->second.getRealtime(getCurrentTime());
        TIME_FORMAT f1;
        double ctime = convertToHighest(f1, time);

        ss << printable(time, HIGHEST) << " ";
        //percentage = 0, 100
        if (percentage > 0.0001) {
            double approx = time / percentage * (100.0 - percentage);
            double capprox = convertToHighest(f1, approx);
            ss << printable(approx, HIGHEST);
        }
        return ss.str();
    }
    else {
        std::cout << "No timer called " << name << " found.";
    }
    std::cout << std::endl;
    return "";
}
开发者ID:johanbecknoren,项目名称:schumacher,代码行数:25,代码来源:timer.cpp


示例2: xsasl_dovecot_parse_reply_args

static 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,代码来源:xsasl_dovecot_server.c


示例3: print_payload

void print_payload( const u_char * payload, int len )
{
   	int line_width = 16;
	int count = len / line_width;
	int i = 0;
	int index = 0;
	char str[17] = {'\0'};

	printf( "\n\n\n" );

	while( count-- ){
		for( i = 0; i < line_width; i++, index++ ){
			printf( "%02X ", payload[index] );
			str[i] = printable( payload[index] );
		}
		str[i] = '\0';
		printf( "\t%s\n", str );
	}
	for( i = 0; i < line_width; i++, index++ ){
		if( index < len ){
			printf( "%02X ", payload[index] );
			str[i] = printable( payload[index] );
		}
		else
			printf( "   " );
		str[i+1] = '\0';

	}
	printf( "\t%s\n", str );

	printf( "\n\n\n" );
}
开发者ID:WangLin2011,项目名称:simple_port_scanner,代码行数:32,代码来源:captpacket.c


示例4: hexdump

static int hexdump(FILE* out, FILE* fh, const char* filename)
{
    int i;
    int count;
    unsigned long offset;
    char buf[kWidth + 1] = {0};
    (void)filename;
    offset = 0;
    while(true)
    {
        count = fread(buf, sizeof(char), kWidth, fh);
        fprintf(out, "%07lx: ", offset);
        offset += kWidth;
        for(i=0; i<count; i++)
        {
            fprintf(out, "%02X ", (unsigned char)buf[i]);
        }
        if(count < kWidth)
        {
            for(i = 0; i < (kWidth - count); i++)
            {
                fputs("   ", out);
            }
            printable(out, buf, count);
            fputc('\n', out);
            break;
        }
        printable(out, buf, kWidth);
        fputc('\n', out);
        fflush(out);
    }
    return 0;
}
开发者ID:apfeltee,项目名称:unixbox,代码行数:33,代码来源:xxd.cpp


示例5: main

int
main(int argc, char *argv[])
{
    int opt, xfnd;
    char *pstr;

    xfnd = 0;
    pstr = NULL;

    while ((opt = getopt(argc, argv, ":p:x")) != -1) {
        printf("opt =%3d (%c); optind = %d", opt, printable(opt), optind);
        if (opt == '?' || opt == ':')
            printf("; optopt =%3d (%c)", optopt, printable(optopt));
        printf("\n");

        switch (opt) {
        case 'p': pstr = optarg;        break;
        case 'x': xfnd++;               break;
        case ':': usageError(argv[0], "Missing argument", optopt);
        case '?': usageError(argv[0], "Unrecognized option", optopt);
        default:  fatal("Unexpected case in switch()");
        }
    }

    if (xfnd != 0)
        printf("-x was specified (count=%d)\n", xfnd);
    if (pstr != NULL)
        printf("-p was specified with the value \"%s\"\n", pstr);
    if (optind < argc)
        printf("First nonoption argument is \"%s\" at argv[%d]\n",
                argv[optind], optind);
    exit(EXIT_SUCCESS);
}
开发者ID:Bipsy,项目名称:Linux,代码行数:33,代码来源:t_getopt.c


示例6: test_conv_base

void test_conv_base( Instance const& conv )
{
  typedef typename Instance::argument_type argument_type ;
  typedef typename Instance::result_type   result_type   ;
  typedef typename Instance::converter     converter ;

  argument_type source = conv.source ;

  try
  {
    result_type result = converter::convert(source);

    if ( conv.post == c_converted )
    {
      BOOST_CHECK_MESSAGE( result == conv.result,
                           conv.to_string() <<  printable(source) << ")= " << printable(result) << ". Expected:" << printable(conv.result)
                         ) ;
    }
    else
    {
      BOOST_ERROR( conv.to_string() << printable(source) << ") = " << printable(result)
                   << ". Expected:" << ( conv.post == c_neg_overflow ? " negative_overflow" : "positive_overflow" )
                 ) ;
    }
  }
  catch ( boost::numeric::negative_overflow const& )
  {
    if ( conv.post == c_neg_overflow )
    {
      BOOST_CHECK_MESSAGE( true, conv.to_string() << printable(source) << ") = negative_overflow, as expected" ) ;
    }
    else
    {
      BOOST_ERROR( conv.to_string() << printable(source) << ") = negative_overflow. Expected:" <<  printable(conv.result) ) ;
    }
  }
  catch ( boost::numeric::positive_overflow const& )
  {
    if ( conv.post == c_pos_overflow )
    {
      BOOST_CHECK_MESSAGE( true, conv.to_string() << printable(source) << ") = positive_overflow, as expected" ) ;
    }
    else
    {
      BOOST_ERROR( conv.to_string() << printable(source) << ") = positive_overflow. Expected:" <<  printable(conv.result) ) ;
    }
  }
  catch ( boost::numeric::bad_numeric_cast const& )
  {
    if ( conv.post == c_overflow )
    {
      BOOST_CHECK_MESSAGE( true, conv.to_string() << printable(source) << ") = bad_numeric_cast, as expected" ) ;
    }
    else
    {
      BOOST_ERROR( conv.to_string() << printable(source) << ") = bad_numeric_cast. Expected:" <<  printable(conv.result) ) ;
    }
  }
}
开发者ID:LancelotGHX,项目名称:Simula,代码行数:59,代码来源:test_helpers3.cpp


示例7: bounce_verp_proto

static int bounce_verp_proto(char *service_name, VSTREAM *client)
{
    char   *myname = "bounce_verp_proto";
    int     flags;

    /*
     * Read and validate the client request.
     */
    if (mail_command_server(client,
			    ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, &flags,
			    ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
			    ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
			    ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
			    ATTR_TYPE_STR, MAIL_ATTR_SENDER, sender,
			    ATTR_TYPE_STR, MAIL_ATTR_VERPDL, verp_delims,
			    ATTR_TYPE_END) != 6) {
	msg_warn("malformed request");
	return (-1);
    }
    if (mail_queue_name_ok(STR(queue_name)) == 0) {
	msg_warn("malformed queue name: %s", printable(STR(queue_name), '?'));
	return (-1);
    }
    if (mail_queue_id_ok(STR(queue_id)) == 0) {
	msg_warn("malformed queue id: %s", printable(STR(queue_id), '?'));
	return (-1);
    }
    if (strlen(STR(verp_delims)) != 2) {
	msg_warn("malformed verp delimiter string: %s",
		 printable(STR(verp_delims), '?'));
	return (-1);
    }
    if (msg_verbose)
	msg_info("%s: flags=0x%x service=%s queue=%s id=%s encoding=%s sender=%s delim=%s",
		 myname, flags, service_name, STR(queue_name), STR(queue_id),
		 STR(encoding), STR(sender), STR(verp_delims));

    /*
     * On request by the client, set up a trap to delete the log file in case
     * of errors.
     */
    if (flags & BOUNCE_FLAG_CLEAN)
	bounce_cleanup_register(service_name, STR(queue_id));

    /*
     * Execute the request. Fall back to traditional notification if a bounce
     * was returned as undeliverable, because we don't want to VERPify those.
     */
    if (!*STR(sender) || !strcasecmp(STR(sender), mail_addr_double_bounce())) {
	msg_warn("request to send VERP-style notification of bounced mail");
	return (bounce_notify_service(flags, service_name, STR(queue_name),
				      STR(queue_id), STR(encoding),
				      STR(sender)));
    } else
	return (bounce_notify_verp(flags, service_name, STR(queue_name),
				   STR(queue_id), STR(encoding),
				   STR(sender), STR(verp_delims)));
}
开发者ID:TonyChengTW,项目名称:Rmail,代码行数:58,代码来源:bounce.c


示例8: bounce_notify_proto

static int bounce_notify_proto(char *service_name, VSTREAM *client,
			        int (*service) (int, char *, char *, char *,
					        char *, char *, char *, int,
						        BOUNCE_TEMPLATES *))
{
    const char *myname = "bounce_notify_proto";
    int     flags;
    int     dsn_ret;

    /*
     * Read and validate the client request.
     */
    if (mail_command_server(client,
			    ATTR_TYPE_INT, MAIL_ATTR_FLAGS, &flags,
			    ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
			    ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
			    ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
			    ATTR_TYPE_STR, MAIL_ATTR_SENDER, sender,
			    ATTR_TYPE_STR, MAIL_ATTR_DSN_ENVID, dsn_envid,
			    ATTR_TYPE_INT, MAIL_ATTR_DSN_RET, &dsn_ret,
			    ATTR_TYPE_END) != 7) {
	msg_warn("malformed request");
	return (-1);
    }

    /*
     * Sanitize input.
     */
    if (mail_queue_name_ok(STR(queue_name)) == 0) {
	msg_warn("malformed queue name: %s", printable(STR(queue_name), '?'));
	return (-1);
    }
    if (mail_queue_id_ok(STR(queue_id)) == 0) {
	msg_warn("malformed queue id: %s", printable(STR(queue_id), '?'));
	return (-1);
    }
    printable(STR(dsn_envid), '?');
    if (msg_verbose)
	msg_info("%s: flags=0x%x service=%s queue=%s id=%s encoding=%s sender=%s envid=%s ret=0x%x",
		 myname, flags, service_name, STR(queue_name), STR(queue_id),
		 STR(encoding), STR(sender), STR(dsn_envid), dsn_ret);

    /*
     * On request by the client, set up a trap to delete the log file in case
     * of errors.
     */
    if (flags & BOUNCE_FLAG_CLEAN)
	bounce_cleanup_register(service_name, STR(queue_id));

    /*
     * Execute the request.
     */
    return (service(flags, service_name, STR(queue_name),
		    STR(queue_id), STR(encoding),
		    STR(sender), STR(dsn_envid), dsn_ret,
		    bounce_templates));
}
开发者ID:Gelma,项目名称:Postfix,代码行数:57,代码来源:bounce.c


示例9: smtpd_sasl_authenticate

int     smtpd_sasl_authenticate(SMTPD_STATE *state,
				        const char *sasl_method,
				        const char *init_response)
{
    int     status;
    const char *sasl_username;

    /*
     * SASL authentication protocol start-up. Process any initial client
     * response that was sent along in the AUTH command.
     */
    for (status = xsasl_server_first(state->sasl_server, sasl_method,
				     init_response, state->sasl_reply);
	 status == XSASL_AUTH_MORE;
	 status = xsasl_server_next(state->sasl_server, STR(state->buffer),
				    state->sasl_reply)) {

	/*
	 * Send a server challenge.
	 */
	smtpd_chat_reply(state, "334 %s", STR(state->sasl_reply));

	/*
	 * Receive the client response. "*" means that the client gives up.
	 * XXX For now we ignore the fact that an excessively long response
	 * will be chopped into multiple reponses. To handle such responses,
	 * we need to change smtpd_chat_query() so that it returns an error
	 * indication.
	 */
	smtpd_chat_query(state);
	if (strcmp(STR(state->buffer), "*") == 0) {
	    msg_warn("%s: SASL %s authentication aborted",
		     state->namaddr, sasl_method);
	    smtpd_chat_reply(state, "501 5.7.0 Authentication aborted");
	    return (-1);
	}
    }
    if (status != XSASL_AUTH_DONE) {
	msg_warn("%s: SASL %s authentication failed: %s",
		 state->namaddr, sasl_method,
		 STR(state->sasl_reply));
	/* RFC 4954 Section 6. */
	smtpd_chat_reply(state, "535 5.7.8 Error: authentication failed: %s",
			 STR(state->sasl_reply));
	return (-1);
    }
    /* RFC 4954 Section 6. */
    smtpd_chat_reply(state, "235 2.7.0 Authentication successful");
    if ((sasl_username = xsasl_server_get_username(state->sasl_server)) == 0)
	msg_panic("cannot look up the authenticated SASL username");
    state->sasl_username = mystrdup(sasl_username);
    printable(state->sasl_username, '?');
    state->sasl_method = mystrdup(sasl_method);
    printable(state->sasl_method, '?');

    return (0);
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:57,代码来源:smtpd_sasl_glue.c


示例10: bounce_one_proto

static int bounce_one_proto(char *service_name, VSTREAM *client)
{
    char   *myname = "bounce_one_proto";
    int     flags;
    long    offset;

    /*
     * Read and validate the client request.
     */
    if (mail_command_server(client,
			    ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, &flags,
			    ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
			    ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
			    ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
			    ATTR_TYPE_STR, MAIL_ATTR_SENDER, sender,
			    ATTR_TYPE_STR, MAIL_ATTR_ORCPT, orig_rcpt,
			    ATTR_TYPE_STR, MAIL_ATTR_RECIP, recipient,
			    ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, &offset,
			    ATTR_TYPE_STR, MAIL_ATTR_STATUS, dsn_status,
			    ATTR_TYPE_STR, MAIL_ATTR_ACTION, dsn_action,
			    ATTR_TYPE_STR, MAIL_ATTR_WHY, why,
			    ATTR_TYPE_END) != 11) {
	msg_warn("malformed request");
	return (-1);
    }
    if (strcmp(service_name, MAIL_SERVICE_BOUNCE) != 0) {
	msg_warn("wrong service name \"%s\" for one-recipient bouncing",
		 service_name);
	return (-1);
    }
    if (mail_queue_name_ok(STR(queue_name)) == 0) {
	msg_warn("malformed queue name: %s", printable(STR(queue_name), '?'));
	return (-1);
    }
    if (mail_queue_id_ok(STR(queue_id)) == 0) {
	msg_warn("malformed queue id: %s", printable(STR(queue_id), '?'));
	return (-1);
    }
    if (msg_verbose)
	msg_info("%s: flags=0x%x queue=%s id=%s encoding=%s sender=%s orig_to=%s to=%s off=%ld stat=%s act=%s why=%s",
	       myname, flags, STR(queue_name), STR(queue_id), STR(encoding),
		 STR(sender), STR(orig_rcpt), STR(recipient), offset,
		 STR(dsn_status), STR(dsn_action), STR(why));

    /*
     * Execute the request.
     */
    return (bounce_one_service(flags, STR(queue_name), STR(queue_id),
			       STR(encoding), STR(sender), STR(orig_rcpt),
			       STR(recipient), offset, STR(dsn_status),
			       STR(dsn_action), STR(why)));
}
开发者ID:TonyChengTW,项目名称:Rmail,代码行数:52,代码来源:bounce.c


示例11: allprint

void
allprint(char c)
{

	switch(c) {
	case '\n':
		fprintf(yyout,"\\n");
		break;
	case '\t':
		fprintf(yyout,"\\t");
		break;
	case '\b':
		fprintf(yyout,"\\b");
		break;
	case ' ':
		fprintf(yyout,"\\\bb");
		break;
	default:
		if(!printable(c))
			fprintf(yyout,"\\%-3o",c);
		else 
			c = putc(c,yyout);
			USED(c);
		break;
	}
	return;
}
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:27,代码来源:allprint.c


示例12: return

char   *smtpd_sasl_mail_opt(SMTPD_STATE *state, const char *addr)
{

    /*
     * Do not store raw RFC2554 protocol data.
     */
    if (!smtpd_sasl_is_active(state)) {
	state->error_mask |= MAIL_ERROR_PROTOCOL;
	return ("503 5.5.4 Error: authentication disabled");
    }
#if 0
    if (state->sasl_username == 0) {
	state->error_mask |= MAIL_ERROR_PROTOCOL;
	return ("503 5.5.4 Error: send AUTH command first");
    }
#endif
    if (state->sasl_sender != 0) {
	state->error_mask |= MAIL_ERROR_PROTOCOL;
	return ("503 5.5.4 Error: multiple AUTH= options");
    }
    if (strcmp(addr, "<>") != 0) {
	state->sasl_sender = mystrdup(addr);
	printable(state->sasl_sender, '?');
    }
    return (0);
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:26,代码来源:smtpd_sasl_proto.c


示例13: send_nntp

void send_nntp(const char *format, ...)
{
    char    *out, p[4];
    va_list va_ptr;

    out = calloc(4096, sizeof(char));

    va_start(va_ptr, format);
    vsnprintf(out, 4096, format, va_ptr);
    va_end(va_ptr);

    /*
     * Only log responses
     */
    if (out[3] == ' ') {
	memset(&p, 0, sizeof(p));
    	strncpy(p, out, 3);
	if (atoi(p) > 0) {
	    Syslog('n', "> \"%s\"", printable(out, 0));
	}
    }

    PUTSTR(out);
    PUTSTR((char *)"\r\n");
    FLUSHOUT();
    sentbytes += (strlen(out) + 2);
    free(out);
}
开发者ID:ftnapps,项目名称:FTNd,代码行数:28,代码来源:ftnnntp.c


示例14: basedump

void basedump (FILE* file, node* root)
{
  if ( root != NULL )
  {
    int i, j; /* iterators */

    basedump (file, root->right);
    basedump (file, root->left);
    fprintf (file, "%d %d \n", root->record->key, root->record->index);
    printable(root->record->name);
    fprintf (file,"%s\n",root->record->name);
    fprintf (file, "[");
    for(i=0;i<root->record->size;i++)
    {
      for(j=0;j<root->record->size;j++)
      {
        fprintf(file,"%g ",root->record->matrix[i][j]);
      }
      if (i+1 < root->record->size)
        fprintf(file,";");
    }
    fprintf (file, "] \n");
    fprintf (file, "%d \n", root->record->size);

  }
}
开发者ID:matfil,项目名称:projekt3,代码行数:26,代码来源:save.c


示例15: format_next_process

char *
format_next_process(caddr_t handle, char *(*get_userid) ())

{
	struct prpsinfo *pp;
	struct handle *hp;
	long		cputime;

	/* find and remember the next proc structure */
	hp = (struct handle *) handle;
	pp = *(hp->next_proc++);
	hp->remaining--;

	/* get the process cpu usage since startup */
	cputime = pp->pr_time.tv_sec;

	/* format this entry */
	sprintf(fmt,
			Proc_format,
			pp->pr_pid,
			pp->pr_pgrp,
			(*get_userid) (pp->pr_uid),
			format_prio(pp),
			format_k(pagetok(pp->pr_size)),
			format_k(pagetok(pp->pr_rssize)),
			format_state(pp),
			format_time(cputime),
			clip_percent(weighted_cpu(pp)),
			clip_percent(percent_cpu(pp)),
			printable(pp->pr_fname));

	/* return the result */
	return (fmt);
}
开发者ID:mwongatemma,项目名称:pg_top,代码行数:34,代码来源:m_irixsgi.c


示例16: initialize

/* Get partition names.  Check against match list */
void
initialize()
{
    const char *scan_fmt = NULL;

    scan_fmt = "%4d %4d %31s %u";

    while (fgets(buffer, sizeof(buffer), iofp)) {
        unsigned int reads = 0;
        struct part_info curr;

        if (sscanf(buffer, scan_fmt, &curr.major, &curr.minor,
                    curr.name, &reads) == 4) {
            unsigned int p;

            for (p = 0; p < n_partitions
                    && (partition[p].major != curr.major
                        || partition[p].minor != curr.minor);
                    p++);

            if (p == n_partitions && p < MAX_PARTITIONS) {
                if (reads && printable(curr.major,curr.minor)) {
                    partition[p] = curr;
                    n_partitions = p + 1;
                }
            }
        }
    }
}
开发者ID:nksosoon,项目名称:tsar,代码行数:30,代码来源:mod_io.c


示例17: tls_verify_certificate_callback

int     tls_verify_certificate_callback(int ok, X509_STORE_CTX *ctx)
{
    char    buf[CCERT_BUFSIZ];
    X509   *cert;
    int     err;
    int     depth;
    int     max_depth;
    SSL    *con;
    TLS_SESS_STATE *TLScontext;

    /* May be NULL as of OpenSSL 1.0, thanks for the API change! */
    cert = X509_STORE_CTX_get_current_cert(ctx);
    err = X509_STORE_CTX_get_error(ctx);
    con = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
    TLScontext = SSL_get_ex_data(con, TLScontext_index);
    depth = X509_STORE_CTX_get_error_depth(ctx);

    /* Don't log the internal root CA unless there's an unexpected error. */
    if (ok && TLScontext->tadepth > 0 && depth > TLScontext->tadepth)
	return (1);

    /*
     * Certificate chain depth limit violations are mis-reported by the
     * OpenSSL library, from SSL_CTX_set_verify(3):
     * 
     * The certificate verification depth set with SSL[_CTX]_verify_depth()
     * stops the verification at a certain depth. The error message produced
     * will be that of an incomplete certificate chain and not
     * X509_V_ERR_CERT_CHAIN_TOO_LONG as may be expected.
     * 
     * We set a limit that is one higher than the user requested limit. If this
     * higher limit is reached, we raise an error even a trusted root CA is
     * present at this depth. This disambiguates trust chain truncation from
     * an incomplete trust chain.
     */
    max_depth = SSL_get_verify_depth(con) - 1;

    /*
     * We never terminate the SSL handshake in the verification callback,
     * rather we allow the TLS handshake to continue, but mark the session as
     * unverified. The application is responsible for closing any sessions
     * with unverified credentials.
     */
    if (max_depth >= 0 && depth > max_depth) {
	X509_STORE_CTX_set_error(ctx, err = X509_V_ERR_CERT_CHAIN_TOO_LONG);
	ok = 0;
    }
    if (ok == 0)
	update_error_state(TLScontext, depth, cert, err);

    if (TLScontext->log_mask & TLS_LOG_VERBOSE) {
	if (cert)
	    X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf));
	else
	    strcpy(buf, "<unknown>");
	msg_info("%s: depth=%d verify=%d subject=%s",
		 TLScontext->namaddr, depth, ok, printable(buf, '?'));
    }
    return (1);
}
开发者ID:Jingeun,项目名称:tongsu_smtp,代码行数:60,代码来源:tls_verify.c


示例18: msg_panic

const char *tls_dns_name(const GENERAL_NAME * gn,
			         const TLS_SESS_STATE *TLScontext)
{
    const char *myname = "tls_dns_name";
    char   *cp;
    const char *dnsname;
    int     len;

    /*
     * Peername checks are security sensitive, carefully scrutinize the
     * input!
     */
    if (gn->type != GEN_DNS)
	msg_panic("%s: Non DNS input argument", myname);

    /*
     * We expect the OpenSSL library to construct GEN_DNS extesion objects as
     * ASN1_IA5STRING values. Check we got the right union member.
     */
    if (ASN1_STRING_type(gn->d.ia5) != V_ASN1_IA5STRING) {
	msg_warn("%s: %s: invalid ASN1 value type in subjectAltName",
		 myname, TLScontext->namaddr);
	return (0);
    }

    /*
     * Safe to treat as an ASCII string possibly holding a DNS name
     */
    dnsname = (char *) ASN1_STRING_data(gn->d.ia5);
    len = ASN1_STRING_length(gn->d.ia5);
    TRIM0(dnsname, len);

    /*
     * Per Dr. Steven Henson of the OpenSSL development team, ASN1_IA5STRING
     * values can have internal ASCII NUL values in this context because
     * their length is taken from the decoded ASN1 buffer, a trailing NUL is
     * always appended to make sure that the string is terminated, but the
     * ASN.1 length may differ from strlen().
     */
    if (len != strlen(dnsname)) {
	msg_warn("%s: %s: internal NUL in subjectAltName",
		 myname, TLScontext->namaddr);
	return 0;
    }

    /*
     * XXX: Should we be more strict and call valid_hostname()? So long as
     * the name is safe to handle, if it is not a valid hostname, it will not
     * compare equal to the expected peername, so being more strict than
     * "printable" is likely excessive...
     */
    if (*dnsname && !allprint(dnsname)) {
	cp = mystrdup(dnsname);
	msg_warn("%s: %s: non-printable characters in subjectAltName: %.100s",
		 myname, TLScontext->namaddr, printable(cp, '?'));
	myfree(cp);
	return 0;
    }
    return (dnsname);
}
开发者ID:Jingeun,项目名称:tongsu_smtp,代码行数:60,代码来源:tls_verify.c


示例19: printable

ostream &FrTextSpan::printValue(ostream &output) const
{
   FrList *span = printable() ;
   output << span ;
   free_object(span) ;
   return output ;
}
开发者ID:ralfbrown,项目名称:framepac,代码行数:7,代码来源:frtxtspn.C


示例20: usageError

static void             /* Print "usage" message and exit */
usageError(char *progName, char *msg, int opt)
{
    if (msg != NULL && opt != 0)
        fprintf(stderr, "%s (-%c)\n", msg, printable(opt));
    fprintf(stderr, "Usage: %s [-p arg] [-x]\n", progName);
    exit(EXIT_FAILURE);
}
开发者ID:Bipsy,项目名称:Linux,代码行数:8,代码来源:t_getopt.c



注:本文中的printable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ printb函数代码示例发布时间:2022-05-30
下一篇:
C++ print_word函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap