Skip to content

Commit

Permalink
more whitespace and newlinge cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mproehl committed Apr 8, 2015
1 parent b8500bb commit 4e5f4b7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
27 changes: 13 additions & 14 deletions msktldap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ int ldap_set_supportedEncryptionTypes(const std::string &dn, msktutil_flags *fla
if (flags->ad_supportedEncryptionTypes != flags->supportedEncryptionTypes) {
std::string supportedEncryptionTypes = sform("%d", flags->supportedEncryptionTypes);

VERBOSE("DEE dn=%s old=%d new=%d\n",
dn.c_str(), flags->ad_supportedEncryptionTypes, flags->supportedEncryptionTypes);

ret = ldap_simple_set_attr(flags->ldap, dn, "msDs-supportedEncryptionTypes",
Expand All @@ -447,7 +446,7 @@ int ldap_set_supportedEncryptionTypes(const std::string &dn, msktutil_flags *fla
flags->ad_supportedEncryptionTypes = flags->supportedEncryptionTypes;
}
} else {
VERBOSE("No need to change msDs-supportedEncryptionTypes they are %d\n",flags->ad_supportedEncryptionTypes);
VERBOSE("No need to change msDs-supportedEncryptionTypes they are %d",flags->ad_supportedEncryptionTypes);
ret = LDAP_SUCCESS;
}

Expand Down Expand Up @@ -502,7 +501,7 @@ int ldap_set_userAccountControl_flag(const std::string &dn, int mask, msktutil_v
flags->ad_userAccountControl = new_userAcctFlags;
}
} else {
VERBOSE("userAccountControl not changed 0x%x\n", new_userAcctFlags);
VERBOSE("userAccountControl not changed 0x%x", new_userAcctFlags);
ret = LDAP_SUCCESS;
}

Expand Down Expand Up @@ -653,12 +652,12 @@ void ldap_check_account_strings(msktutil_flags *flags)
upn_found = flags->ldap->get_one_val(mesg, "userPrincipalName");
}
ldap_msgfree(mesg);
VERBOSE("Found userPrincipalName = %s\n", upn_found.c_str());
VERBOSE("userPrincipalName should be %s\n", userPrincipalName_string.c_str());
VERBOSE("Found userPrincipalName = %s", upn_found.c_str());
VERBOSE("userPrincipalName should be %s", userPrincipalName_string.c_str());
if (upn_found.compare(userPrincipalName_string)) {
ldap_simple_set_attr(flags->ldap, dn, "userPrincipalName", userPrincipalName_string, flags);
} else {
VERBOSE("Nothing to do\n");
VERBOSE("Nothing to do");
}
}
ldap_set_supportedEncryptionTypes(dn, flags);
Expand Down Expand Up @@ -731,15 +730,15 @@ void ldap_check_account(msktutil_flags *flags)
std::string uac = flags->ldap->get_one_val(mesg, "userAccountControl");
if(!uac.empty()) {
flags->ad_userAccountControl = atoi(uac.c_str());
VERBOSE("Found userAccountControl = 0x%x\n",flags->ad_userAccountControl);
VERBOSE("Found userAccountControl = 0x%x",flags->ad_userAccountControl);
}

/* save the current msDs-supportedEncryptionTypes */
std::string supportedEncryptionTypes = flags->ldap->get_one_val(mesg, "msDs-supportedEncryptionTypes");
if (!supportedEncryptionTypes.empty()) {
flags->ad_supportedEncryptionTypes = atoi(supportedEncryptionTypes.c_str());
flags->ad_enctypes = VALUE_ON; /* actual value found in AD */
VERBOSE("Found supportedEncryptionTypes = %d\n",
VERBOSE("Found supportedEncryptionTypes = %d",
flags->ad_supportedEncryptionTypes);
} else {
/* Not in current LDAP entry set defaults */
Expand All @@ -749,14 +748,14 @@ void ldap_check_account(msktutil_flags *flags)
flags->ad_supportedEncryptionTypes |= MS_KERB_ENCTYPE_RC4_HMAC_MD5;
}
flags->ad_enctypes = VALUE_OFF; /* this is the assumed default */
VERBOSE("Found default supportedEncryptionTypes = %d\n",
VERBOSE("Found default supportedEncryptionTypes = %d",
flags->ad_supportedEncryptionTypes);
}

if (!flags->use_service_account) {
// Save current dNSHostName
flags->ad_dnsHostName = flags->ldap->get_one_val(mesg, "dNSHostName");
VERBOSE("Found dNSHostName = %s\n", flags->ad_dnsHostName.c_str());
VERBOSE("Found dNSHostName = %s", flags->ad_dnsHostName.c_str());
}

// Save current servicePrincipalName and userPrincipalName attrs
Expand All @@ -769,11 +768,11 @@ void ldap_check_account(msktutil_flags *flags)
vals[i].replace(0, 5, "host/");
}
flags->ad_principals.push_back(vals[i]);
VERBOSE(" Found Principal: %s", vals[i].c_str());
VERBOSE("Found Principal: %s", vals[i].c_str());
}

if (flags->set_userPrincipalName) {
VERBOSE(" userPrincipal specified on command line");
VERBOSE("userPrincipal specified on command line");
} else {
std::string upn = flags->ldap->get_one_val(mesg, "userPrincipalName");
if(!upn.empty()) {
Expand All @@ -794,10 +793,10 @@ void ldap_check_account(msktutil_flags *flags)

/* No computer account found, so let's add one in the OU specified */
if (flags->use_service_account) {
VERBOSE("Service account not found, create the account\n");
VERBOSE("Service account not found, create the account");
fprintf(stdout, "No service account for %s found, creating a new one.\n", flags->samAccountName.c_str());
} else {
VERBOSE("Computer account not found, create the account\n");
VERBOSE("Computer account not found, create the account");
fprintf(stdout, "No computer account for %s found, creating a new one.\n", flags->samAccountName_nodollar.c_str());
}
flags->ad_computerDn = sform("cn=%s,%s", flags->samAccountName_nodollar.c_str(), flags->ldap_ou.c_str());
Expand Down
8 changes: 4 additions & 4 deletions msktpass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int set_password(msktutil_flags *flags)
VERBOSE("Attempting to reset computer's password");
}
if (flags->auth_type == AUTH_FROM_USER_CREDS) {
VERBOSE("Try change password using user's ticket cache\n");
VERBOSE("Try change password using user's ticket cache");

KRB5CCache ccache(KRB5CCache::defaultName());
KRB5Principal principal(flags->samAccountName);
Expand Down Expand Up @@ -193,21 +193,21 @@ int set_password(msktutil_flags *flags)
} else {
princ_name = "host/" + flags->hostname;
}
VERBOSE("Try using keytab for %s to change password\n", princ_name.c_str());
VERBOSE("Try using keytab for %s to change password", princ_name.c_str());

KRB5Keytab keytab(flags->keytab_readname);
KRB5Principal principal(princ_name);
KRB5Creds local_creds(principal, keytab, "kadmin/changepw");
creds.move_from(local_creds);
} else if (flags->auth_type == AUTH_FROM_PASSWORD) {
VERBOSE("Try using default password for %s to change password\n", flags->samAccountName.c_str());
VERBOSE("Try using default password for %s to change password", flags->samAccountName.c_str());

KRB5Principal principal(flags->samAccountName);
KRB5Creds local_creds(principal, create_default_machine_password(flags->samAccountName), "kadmin/changepw");
creds.move_from(local_creds);
} else if ((flags->auth_type == AUTH_FROM_SUPPLIED_PASSWORD) ||
(flags->auth_type == AUTH_FROM_SUPPLIED_EXPIRED_PASSWORD)) {
VERBOSE("Try using supplied password for %s to change password\n", flags->samAccountName.c_str());
VERBOSE("Try using supplied password for %s to change password", flags->samAccountName.c_str());
KRB5Principal principal(flags->samAccountName);
KRB5Creds local_creds(principal, flags->old_account_password, "kadmin/changepw");
creds.move_from(local_creds);
Expand Down
4 changes: 2 additions & 2 deletions msktutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ int finalize_exec(msktutil_exec *exec)
}
}

VERBOSE("Authenticated using method %d\n", flags->auth_type);
VERBOSE("Authenticated using method %d", flags->auth_type);

flags->ldap = ldap_connect(flags->server, flags->no_reverse_lookups);

Expand Down Expand Up @@ -506,7 +506,7 @@ int execute(msktutil_exec *exec)
// And add and remove principals to servicePrincipalName in LDAP.
add_and_remove_principals(exec);

VERBOSE("Updating all entries for %s in the keytab %s\n", flags->hostname.c_str(),
VERBOSE("Updating all entries for %s in the keytab %s", flags->hostname.c_str(),
flags->keytab_writename.c_str());
update_keytab(flags);
wait_for_new_kvno(exec);
Expand Down

0 comments on commit 4e5f4b7

Please sign in to comment.