示例#1
0
const char *get_password(common_info_st * cinfo, unsigned int *flags,
			 int confirm)
{
	if (cinfo->null_password) {
		if (flags)
			*flags |= GNUTLS_PKCS_NULL_PASSWORD;
		return NULL;
	} else if (cinfo->password) {
		if (cinfo->password[0] == 0 && flags)
			*flags |= GNUTLS_PKCS_PLAIN;
		return cinfo->password;
	} else {
		if (confirm)
			return get_confirmed_pass(true);
		else
			return get_pass();
	}
}
示例#2
0
const char *get_password(common_info_st * cinfo, unsigned int *flags,
			 int confirm)
{
	const char *p;

	if (cinfo->null_password) {
		if (flags)
			*flags |= GNUTLS_PKCS_NULL_PASSWORD;
		return NULL;
	} else if (cinfo->password) {
		p = cinfo->password;
	} else {
		if (confirm)
			p = get_confirmed_pass(true);
		else
			p = get_pass();
	}

	if ((p == NULL || p[0] == 0) && flags && !cinfo->empty_password)
		*flags |= GNUTLS_PKCS_PLAIN;

	return p;
}