msktutil.h (msktutil-1.1.tar.bz2) | : | msktutil.h (msktutil-1.2.1) | ||
---|---|---|---|---|
skipping to change at line 51 | skipping to change at line 51 | |||
#include <unistd.h> | #include <unistd.h> | |||
#include <signal.h> | #include <signal.h> | |||
#include <ctype.h> | #include <ctype.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <time.h> | #include <time.h> | |||
#include <limits.h> | #include <limits.h> | |||
#include <netdb.h> | #include <netdb.h> | |||
#include <netinet/in.h> | #include <netinet/in.h> | |||
#include <sys/socket.h> | #include <sys/socket.h> | |||
#include <sys/utsname.h> | ||||
#include <ldap.h> | #include <ldap.h> | |||
#include <list> | #include <list> | |||
#ifdef HAVE_COM_ERR_H | #ifdef HAVE_COM_ERR_H | |||
# ifdef COM_ERR_NEEDS_EXTERN_C | # ifdef COM_ERR_NEEDS_EXTERN_C | |||
extern "C" { | extern "C" { | |||
# endif | # endif | |||
#include <com_err.h> | #include <com_err.h> | |||
# ifdef COM_ERR_NEEDS_EXTERN_C | # ifdef COM_ERR_NEEDS_EXTERN_C | |||
} | } | |||
skipping to change at line 99 | skipping to change at line 98 | |||
/* From SAM.H */ | /* From SAM.H */ | |||
#define UF_WORKSTATION_TRUST_ACCOUNT 0x00001000 | #define UF_WORKSTATION_TRUST_ACCOUNT 0x00001000 | |||
#define UF_ACCOUNT_DISABLE 0x00000002 | #define UF_ACCOUNT_DISABLE 0x00000002 | |||
#define UF_NORMAL_ACCOUNT 0x00000200 | #define UF_NORMAL_ACCOUNT 0x00000200 | |||
#define UF_DONT_EXPIRE_PASSWORD 0x00010000 | #define UF_DONT_EXPIRE_PASSWORD 0x00010000 | |||
#define UF_TRUSTED_FOR_DELEGATION 0x00080000 | #define UF_TRUSTED_FOR_DELEGATION 0x00080000 | |||
#define UF_USE_DES_KEY_ONLY 0x00200000 | #define UF_USE_DES_KEY_ONLY 0x00200000 | |||
#define UF_NO_AUTH_DATA_REQUIRED 0x02000000 | #define UF_NO_AUTH_DATA_REQUIRED 0x02000000 | |||
/* for msDs-supportedEncryptionTypes bit defines */ | /* for msDs-supportedEncryptionTypes bit defines */ | |||
#define MS_KERB_ENCTYPE_DES_CBC_CRC 0x01 | #define MS_KERB_ENCTYPE_DES_CBC_CRC 0x01 | |||
#define MS_KERB_ENCTYPE_DES_CBC_MD5 0x02 | #define MS_KERB_ENCTYPE_DES_CBC_MD5 0x02 | |||
#define MS_KERB_ENCTYPE_RC4_HMAC_MD5 0x04 | #define MS_KERB_ENCTYPE_RC4_HMAC_MD5 0x04 | |||
/* Define these if the system supports them, otherwise define to 0. */ | /* Define these if the system supports them, otherwise define to 0. */ | |||
#if HAVE_DECL_ENCTYPE_AES128_CTS_HMAC_SHA1_96 | #if HAVE_DECL_ENCTYPE_AES128_CTS_HMAC_SHA1_96 | |||
#define MS_KERB_ENCTYPE_AES128_CTC_HMAC_SHA1_96 0x08 | #define MS_KERB_ENCTYPE_AES128_CTC_HMAC_SHA1_96 0x08 | |||
#else | #else | |||
#define MS_KERB_ENCTYPE_AES128_CTC_HMAC_SHA1_96 0 | #define MS_KERB_ENCTYPE_AES128_CTC_HMAC_SHA1_96 0 | |||
#endif | #endif | |||
#if HAVE_DECL_ENCTYPE_AES128_CTS_HMAC_SHA1_96 | #if HAVE_DECL_ENCTYPE_AES128_CTS_HMAC_SHA1_96 | |||
#define MS_KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x10 | #define MS_KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x10 | |||
#else | #else | |||
#define MS_KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 0 | #define MS_KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 0 | |||
#endif | #endif | |||
#define MS_KERB_DES_ENCTYPES \ | ||||
( MS_KERB_ENCTYPE_DES_CBC_CRC | \ | ||||
MS_KERB_ENCTYPE_DES_CBC_MD5 ) | ||||
#define DEFAULT_MS_KERB_ENCTYPES \ | ||||
( MS_KERB_ENCTYPE_RC4_HMAC_MD5 | \ | ||||
MS_KERB_ENCTYPE_AES128_CTC_HMAC_SHA1_96 | \ | ||||
MS_KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 ) | ||||
#define ALL_MS_KERB_ENCTYPES \ | ||||
( MS_KERB_DES_ENCTYPES | \ | ||||
MS_KERB_ENCTYPE_RC4_HMAC_MD5 | \ | ||||
MS_KERB_ENCTYPE_AES128_CTC_HMAC_SHA1_96 | \ | ||||
MS_KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 ) | ||||
/* Some KVNO Constansts */ | /* Some KVNO Constansts */ | |||
#define KVNO_FAILURE -1 | #define KVNO_FAILURE -1 | |||
#define KVNO_WIN_2000 0 | #define KVNO_WIN_2000 0 | |||
#define DEFAULT_SAMBA_CMD "net changesecretpw -f -i" | ||||
/* Default candidate SASL mechanisms */ | ||||
#define DEFAULT_SASL_MECHANISMS "GSS-SPNEGO GSSAPI" | ||||
/* Ways we can authenticate */ | /* Ways we can authenticate */ | |||
enum auth_types { | enum auth_types { | |||
AUTH_NONE = 0, | AUTH_NONE = 0, | |||
AUTH_FROM_SAM_KEYTAB, | AUTH_FROM_SAM_KEYTAB, | |||
AUTH_FROM_SAM_UPPERCASE_KEYTAB, | AUTH_FROM_SAM_UPPERCASE_KEYTAB, | |||
AUTH_FROM_HOSTNAME_KEYTAB, | AUTH_FROM_HOSTNAME_KEYTAB, | |||
AUTH_FROM_PASSWORD, | AUTH_FROM_PASSWORD, | |||
AUTH_FROM_USER_CREDS, | AUTH_FROM_USER_CREDS, | |||
AUTH_FROM_SUPPLIED_PASSWORD, | AUTH_FROM_SUPPLIED_PASSWORD, | |||
AUTH_FROM_SUPPLIED_EXPIRED_PASSWORD, | AUTH_FROM_SUPPLIED_EXPIRED_PASSWORD, | |||
skipping to change at line 152 | skipping to change at line 171 | |||
extern int g_verbose; | extern int g_verbose; | |||
enum msktutil_mode { | enum msktutil_mode { | |||
MODE_NONE = 0, | MODE_NONE = 0, | |||
MODE_CREATE, | MODE_CREATE, | |||
MODE_UPDATE, | MODE_UPDATE, | |||
MODE_AUTO_UPDATE, | MODE_AUTO_UPDATE, | |||
MODE_FLUSH, | MODE_FLUSH, | |||
MODE_CLEANUP, | MODE_CLEANUP, | |||
MODE_PRECREATE, | MODE_PRECREATE, | |||
MODE_DELETE | MODE_DELETE, | |||
MODE_RESET | ||||
}; | }; | |||
class msktutil_flags { | class msktutil_flags { | |||
public: | public: | |||
std::string keytab_file; | std::string keytab_file; | |||
std::string keytab_writename; | std::string keytab_writename; | |||
std::string keytab_readname; | std::string keytab_readname; | |||
std::string keytab_auth_princ; | std::string keytab_auth_princ; | |||
std::string ldap_ou; | std::string ldap_ou; | |||
std::string hostname; | std::string hostname; | |||
skipping to change at line 186 | skipping to change at line 206 | |||
LDAPConnection* ldap; | LDAPConnection* ldap; | |||
std::string ad_computerDn; | std::string ad_computerDn; | |||
std::string ad_dnsHostName; | std::string ad_dnsHostName; | |||
std::vector<std::string> ad_principals; | std::vector<std::string> ad_principals; | |||
bool set_userPrincipalName; | bool set_userPrincipalName; | |||
bool no_reverse_lookups; | bool no_reverse_lookups; | |||
bool no_canonical_name; | bool no_canonical_name; | |||
bool server_behind_nat; | bool server_behind_nat; | |||
bool set_samba_secret; | bool set_samba_secret; | |||
std::string samba_cmd; | ||||
bool check_replication; | bool check_replication; | |||
bool dont_change_password; | bool dont_change_password; | |||
msktutil_val dont_expire_password; | msktutil_val dont_expire_password; | |||
msktutil_val dont_update_dnshostname; | msktutil_val dont_update_dnshostname; | |||
msktutil_val disable_account; | msktutil_val disable_account; | |||
msktutil_val no_pac; | msktutil_val no_pac; | |||
msktutil_val delegate; | msktutil_val delegate; | |||
unsigned int ad_userAccountControl; /* value AD has now */ | unsigned int ad_userAccountControl; /* value AD has now */ | |||
int ad_enctypes; /* if msDs-supportedEncryptionTypes in AD */ | int ad_enctypes; /* if msDs-supportedEncryptionTypes in AD */ | |||
unsigned int ad_supportedEncryptionTypes; /* value AD has now */ | unsigned int ad_supportedEncryptionTypes; /* value AD has now */ | |||
int enctypes; /* if --enctypes parameter was set */ | int enctypes; /* if --enctypes parameter was set */ | |||
unsigned int supportedEncryptionTypes; | unsigned int supportedEncryptionTypes; | |||
int auth_type; | int auth_type; | |||
bool user_creds_only; | bool user_creds_only; | |||
bool use_service_account; | bool use_service_account; | |||
bool allow_weak_crypto; | bool allow_weak_crypto; | |||
bool password_expired; | bool password_expired; | |||
int auto_update_interval; | int auto_update_interval; | |||
std::string sasl_mechanisms; | ||||
krb5_kvno kvno; | krb5_kvno kvno; | |||
int cleanup_days; | int cleanup_days; | |||
int cleanup_enctype; | int cleanup_enctype; | |||
msktutil_flags(); | msktutil_flags(); | |||
private: | private: | |||
msktutil_flags operator=(const msktutil_flags& other); | msktutil_flags operator=(const msktutil_flags& other); | |||
msktutil_flags(const msktutil_flags& other); | msktutil_flags(const msktutil_flags& other); | |||
~msktutil_flags(); | ~msktutil_flags(); | |||
}; | }; | |||
skipping to change at line 274 | skipping to change at line 296 | |||
extern void add_principal_keytab(const std::string &, msktutil_flags *); | extern void add_principal_keytab(const std::string &, msktutil_flags *); | |||
extern int ldap_flush_principals(msktutil_flags *); | extern int ldap_flush_principals(msktutil_flags *); | |||
extern int set_password(msktutil_flags *); | extern int set_password(msktutil_flags *); | |||
extern krb5_kvno ldap_get_kvno(msktutil_flags *); | extern krb5_kvno ldap_get_kvno(msktutil_flags *); | |||
extern std::string ldap_get_pwdLastSet(msktutil_flags *); | extern std::string ldap_get_pwdLastSet(msktutil_flags *); | |||
extern std::vector<std::string> ldap_list_principals(msktutil_flags *); | extern std::vector<std::string> ldap_list_principals(msktutil_flags *); | |||
extern int ldap_add_principal(const std::string &, msktutil_flags *); | extern int ldap_add_principal(const std::string &, msktutil_flags *); | |||
int ldap_remove_principal(const std::string &principal, msktutil_flags *flags); | int ldap_remove_principal(const std::string &principal, msktutil_flags *flags); | |||
extern std::string get_dc_host(const std::string &realm_name, const std::string &site_name, | extern std::string get_dc_host(const std::string &realm_name, const std::string &site_name, | |||
const bool); | const bool); | |||
extern std::string get_host_os(); | ||||
extern bool ldap_check_account(msktutil_flags *); | extern bool ldap_check_account(msktutil_flags *); | |||
extern void ldap_create_account(msktutil_flags *); | extern void ldap_create_account(msktutil_flags *); | |||
extern int ldap_delete_account(msktutil_flags *); | ||||
extern void create_fake_krb5_conf(msktutil_flags *); | extern void create_fake_krb5_conf(msktutil_flags *); | |||
extern void remove_fake_krb5_conf(); | extern void remove_fake_krb5_conf(); | |||
extern void remove_ccache(); | extern void remove_ccache(); | |||
int find_working_creds(msktutil_flags *flags); | int find_working_creds(msktutil_flags *flags); | |||
bool get_creds(msktutil_flags *flags); | bool get_creds(msktutil_flags *flags); | |||
int generate_new_password(msktutil_flags *flags); | int generate_new_password(msktutil_flags *flags); | |||
/* Verbose messages */ | /* Verbose messages */ | |||
#define VERBOSE(text...) if (g_verbose) { fprintf(stdout, " -- %s: ", __FUNCTION __); fprintf(stdout, ## text); fprintf(stdout, "\n"); } | #define VERBOSE(text...) if (g_verbose) { fprintf(stdout, " -- %s: ", __FUNCTION __); fprintf(stdout, ## text); fprintf(stdout, "\n"); } | |||
skipping to change at line 323 | skipping to change at line 345 | |||
virtual ~Exception() throw() {}; | virtual ~Exception() throw() {}; | |||
char const * what() const throw() { return m_message.c_str(); } | char const * what() const throw() { return m_message.c_str(); } | |||
}; | }; | |||
class KRB5Exception : public Exception | class KRB5Exception : public Exception | |||
{ | { | |||
protected: | protected: | |||
krb5_error_code m_err; | krb5_error_code m_err; | |||
public: | public: | |||
explicit KRB5Exception(const std::string &func, krb5_error_code err) : | explicit KRB5Exception(const std::string &func, krb5_error_code err) : | |||
Exception(sform("Error: %s failed (%s)", func.c_str(), error_message(err ))) | Exception(sform("Error: %s failed: %s", func.c_str(), error_message(err) )) | |||
{ m_err = err; } | { m_err = err; } | |||
krb5_error_code err() const throw() { return m_err; } | krb5_error_code err() const throw() { return m_err; } | |||
}; | }; | |||
class LDAPException : public Exception | class LDAPException : public Exception | |||
{ | { | |||
public: | public: | |||
explicit LDAPException(const std::string &func, int err) : | explicit LDAPException(const std::string &func, int err) : | |||
Exception(sform("Error: %s failed (%s)", func.c_str(), ldap_err2string(e rr))) | Exception(sform("Error: %s failed: %s", func.c_str(), ldap_err2string(er r))) | |||
{} | {} | |||
}; | }; | |||
#ifdef __GNUC__ | #ifdef __GNUC__ | |||
#define ATTRUNUSED __attribute__((unused)) | #define ATTRUNUSED __attribute__((unused)) | |||
#else | #else | |||
#define ATTRUNUSED | #define ATTRUNUSED | |||
#endif | #endif | |||
#include "krb5wrap.h" | #include "krb5wrap.h" | |||
End of changes. 11 change blocks. | ||||
6 lines changed or deleted | 28 lines changed or added |