本文整理汇总了C++中Credential::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Credential::SetName方法的具体用法?C++ Credential::SetName怎么用?C++ Credential::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Credential
的用法示例。
在下文中一共展示了Credential::SetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
break;
default:
fprintf( stderr, "%s: Unknown option %s\n",
myName, *ptr);
usage(myName);
exit(1);
}
} //fi
} //rof
if (( cred_file_name == NULL ) || (cred_type == 0)) {
fprintf ( stderr, "Credential filename or type not specified\n");
exit (1);
}
Credential * cred = NULL;
if (cred_type == X509_CREDENTIAL_TYPE) {
cred = new X509Credential();
} else {
fprintf ( stderr, "Invalid credential type\n");
exit (1);
}
char * data = NULL;
int data_size;
if (!read_file (cred_file_name, data, data_size)) {
fprintf (stderr, "Can't open %s\n", cred_file_name);
exit (1);
}
cred->SetData (data, data_size);
if (cred_name !=NULL) {
cred->SetName(cred_name);
} else {
cred->SetName(DEFAULT_CREDENTIAL_NAME);
}
char * username = my_username(0);
cred->SetOwner (username);
if (cred_type == X509_CREDENTIAL_TYPE && myproxy_host != NULL) {
X509Credential * x509cred = (X509Credential*)cred;
MyString str_host_port = myproxy_host;
if (myproxy_port != 0) {
str_host_port += ":";
str_host_port += myproxy_port;
}
x509cred->SetMyProxyServerHost (str_host_port.Value());
if (myproxy_user != NULL) {
x509cred->SetMyProxyUser (myproxy_user);
} else {
x509cred->SetMyProxyUser (username);
}
if (myproxy_dn != NULL) {
x509cred->SetMyProxyServerDN (myproxy_dn);
}
char * myproxy_password;
if ( Read_Myproxy_pw_terminal ) {
myproxy_password =
prompt_password(
"Please enter the MyProxy password:" );
} else {
myproxy_password =
stdin_password(
"Please enter the MyProxy password from the standard input\n");
}
if (myproxy_password) {
x509cred->SetRefreshPassword ( myproxy_password );
}
x509cred->display( D_FULLDEBUG );
}
CondorError errstack;
DCCredd dc_credd (server_address);
// resolve server address
if ( ! dc_credd.locate() ) {
fprintf (stderr, "%s\n", dc_credd.error() );
return 1;
}
if (dc_credd.storeCredential(cred, errstack)) {
printf ("Credential submitted successfully\n");
} else {
fprintf (stderr, "Unable to submit credential\n%s\n",
errstack.getFullText(true));
return 1;
}
return 0;
}