diff options
author | Simo Sorce <idra@samba.org> | 2010-01-12 11:05:16 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2010-01-12 13:50:24 -0500 |
commit | 3d184399a5ac3604b78ca8cdd5d4e1e3f6412b2d (patch) | |
tree | 13b92020633567fb5d8e792f6a4e93749e490b82 | |
parent | 3b58b2ac39a91c0c9f074abf079f700c7e886841 (diff) | |
download | samba-3d184399a5ac3604b78ca8cdd5d4e1e3f6412b2d.tar.gz samba-3d184399a5ac3604b78ca8cdd5d4e1e3f6412b2d.tar.bz2 samba-3d184399a5ac3604b78ca8cdd5d4e1e3f6412b2d.zip |
Strip trailing spaces
-rw-r--r-- | source4/auth/auth.h | 40 | ||||
-rw-r--r-- | source4/auth/kerberos/kerberos_pac.c | 124 |
2 files changed, 82 insertions, 82 deletions
diff --git a/source4/auth/auth.h b/source4/auth/auth.h index fa2329df32..827b441478 100644 --- a/source4/auth/auth.h +++ b/source4/auth/auth.h @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. Standardised Authentication types Copyright (C) Andrew Bartlett 2001 Copyright (C) Stefan Metzmacher 2005 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -79,13 +79,13 @@ struct auth_usersupplied_info struct samr_Password *lanman; struct samr_Password *nt; } hash; - + char *plaintext; } password; uint32_t flags; }; -struct auth_serversupplied_info +struct auth_serversupplied_info { struct dom_sid *account_sid; struct dom_sid *primary_group_sid; @@ -105,7 +105,7 @@ struct auth_serversupplied_info const char *home_directory; const char *home_drive; const char *logon_server; - + NTTIME last_logon; NTTIME last_logoff; NTTIME acct_expiry; @@ -149,7 +149,7 @@ struct auth_operations { struct auth_serversupplied_info **server_info); /* Lookup a 'server info' return based only on the principal */ - NTSTATUS (*get_server_info_principal)(TALLOC_CTX *mem_ctx, + NTSTATUS (*get_server_info_principal)(TALLOC_CTX *mem_ctx, struct auth_context *auth_context, const char *principal, struct auth_serversupplied_info **server_info); @@ -165,12 +165,12 @@ struct auth_method_context { struct auth_context { struct { - /* Who set this up in the first place? */ + /* Who set this up in the first place? */ const char *set_by; bool may_be_modified; - DATA_BLOB data; + DATA_BLOB data; } challenge; /* methods, in the order they should be called */ @@ -187,16 +187,16 @@ struct auth_context { NTSTATUS (*check_password)(struct auth_context *auth_ctx, TALLOC_CTX *mem_ctx, - const struct auth_usersupplied_info *user_info, + const struct auth_usersupplied_info *user_info, struct auth_serversupplied_info **server_info); - + NTSTATUS (*get_challenge)(struct auth_context *auth_ctx, uint8_t chal[8]); bool (*challenge_may_be_modified)(struct auth_context *auth_ctx); NTSTATUS (*set_challenge)(struct auth_context *auth_ctx, const uint8_t chal[8], const char *set_by); - - NTSTATUS (*get_server_info_principal)(TALLOC_CTX *mem_ctx, + + NTSTATUS (*get_server_info_principal)(TALLOC_CTX *mem_ctx, struct auth_context *auth_context, const char *principal, struct auth_serversupplied_info **server_info); @@ -213,7 +213,7 @@ struct auth_critical_sizes { int sizeof_auth_serversupplied_info; }; - NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth_context *auth_context, + NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth_context *auth_context, enum auth_password_state to_state, const struct auth_usersupplied_info *user_info_in, const struct auth_usersupplied_info **user_info_encrypted); @@ -240,22 +240,22 @@ struct auth_session_info *system_session(struct loadparm_context *lp_ctx); NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx, struct ldb_context *sam_ctx, const char *netbios_name, const char *domain_name, - struct ldb_dn *domain_dn, + struct ldb_dn *domain_dn, struct ldb_message *msg, DATA_BLOB user_sess_key, DATA_BLOB lm_sess_key, struct auth_serversupplied_info **_server_info); -NTSTATUS auth_system_session_info(TALLOC_CTX *parent_ctx, +NTSTATUS auth_system_session_info(TALLOC_CTX *parent_ctx, struct loadparm_context *lp_ctx, struct auth_session_info **_session_info) ; NTSTATUS auth_nt_status_squash(NTSTATUS nt_status); -NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **methods, +NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **methods, struct tevent_context *ev, struct messaging_context *msg, struct loadparm_context *lp_ctx, struct auth_context **auth_ctx); -NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, +NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct messaging_context *msg, struct loadparm_context *lp_ctx, @@ -263,7 +263,7 @@ NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, NTSTATUS auth_check_password(struct auth_context *auth_ctx, TALLOC_CTX *mem_ctx, - const struct auth_usersupplied_info *user_info, + const struct auth_usersupplied_info *user_info, struct auth_serversupplied_info **server_info); NTSTATUS auth_init(void); NTSTATUS auth_register(const struct auth_operations *ops); diff --git a/source4/auth/kerberos/kerberos_pac.c b/source4/auth/kerberos/kerberos_pac.c index 7a6d008562..ecd35f3dfa 100644 --- a/source4/auth/kerberos/kerberos_pac.c +++ b/source4/auth/kerberos/kerberos_pac.c @@ -1,8 +1,8 @@ -/* +/* Unix SMB/CIFS implementation. Create and parse the krb5 PAC - + Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2005,2008 Copyright (C) Andrew Tridgell 2001 Copyright (C) Luke Howard 2002-2003 @@ -12,13 +12,13 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -31,7 +31,7 @@ #include "lib/ldb/include/ldb.h" #include "auth/auth_sam_reply.h" -krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, +krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, DATA_BLOB pac_data, struct PAC_SIGNATURE_DATA *sig, krb5_context context, @@ -50,7 +50,7 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, 0, &crypto); if (ret) { - DEBUG(0,("krb5_crypto_init() failed: %s\n", + DEBUG(0,("krb5_crypto_init() failed: %s\n", smb_get_krb5_error_message(context, ret, mem_ctx))); return ret; } @@ -113,7 +113,7 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - ndr_err = ndr_pull_struct_blob(&blob, pac_data, + ndr_err = ndr_pull_struct_blob(&blob, pac_data, iconv_convenience, pac_data, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -129,7 +129,7 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - ndr_err = ndr_pull_struct_blob(&blob, pac_data_raw, + ndr_err = ndr_pull_struct_blob(&blob, pac_data_raw, iconv_convenience, pac_data_raw, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA_RAW); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -210,7 +210,7 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, /* Find and zero out the signatures, as required by the signing algorithm */ /* We find the data blobs above, now we parse them to get at the exact portion we should zero */ - ndr_err = ndr_pull_struct_blob(kdc_sig_blob, kdc_sig_wipe, + ndr_err = ndr_pull_struct_blob(kdc_sig_blob, kdc_sig_wipe, iconv_convenience, kdc_sig_wipe, (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -219,8 +219,8 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, nt_errstr(status))); return status; } - - ndr_err = ndr_pull_struct_blob(srv_sig_blob, srv_sig_wipe, + + ndr_err = ndr_pull_struct_blob(srv_sig_blob, srv_sig_wipe, iconv_convenience, srv_sig_wipe, (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -233,9 +233,9 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, /* Now zero the decoded structure */ memset(kdc_sig_wipe->signature.data, '\0', kdc_sig_wipe->signature.length); memset(srv_sig_wipe->signature.data, '\0', srv_sig_wipe->signature.length); - + /* and reencode, back into the same place it came from */ - ndr_err = ndr_push_struct_blob(kdc_sig_blob, pac_data_raw, + ndr_err = ndr_push_struct_blob(kdc_sig_blob, pac_data_raw, iconv_convenience, kdc_sig_wipe, (ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA); @@ -245,7 +245,7 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, nt_errstr(status))); return status; } - ndr_err = ndr_push_struct_blob(srv_sig_blob, pac_data_raw, + ndr_err = ndr_push_struct_blob(srv_sig_blob, pac_data_raw, iconv_convenience, srv_sig_wipe, (ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA); @@ -257,7 +257,7 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, } /* push out the whole structure, but now with zero'ed signatures */ - ndr_err = ndr_push_struct_blob(&modified_pac_blob, pac_data_raw, + ndr_err = ndr_push_struct_blob(&modified_pac_blob, pac_data_raw, iconv_convenience, pac_data_raw, (ndr_push_flags_fn_t)ndr_push_PAC_DATA_RAW); @@ -269,9 +269,9 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, } /* verify by service_key */ - ret = check_pac_checksum(mem_ctx, - modified_pac_blob, srv_sig_ptr, - context, + ret = check_pac_checksum(mem_ctx, + modified_pac_blob, srv_sig_ptr, + context, service_keyblock); if (ret) { DEBUG(1, ("PAC Decode: Failed to verify the service signature: %s\n", @@ -283,8 +283,8 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, } if (krbtgt_keyblock) { - ret = check_pac_checksum(mem_ctx, - srv_sig_ptr->signature, kdc_sig_ptr, + ret = check_pac_checksum(mem_ctx, + srv_sig_ptr->signature, kdc_sig_ptr, context, krbtgt_keyblock); if (ret) { DEBUG(1, ("PAC Decode: Failed to verify the KDC signature: %s\n", @@ -306,11 +306,11 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, return NT_STATUS_ACCESS_DENIED; } - ret = krb5_parse_name_flags(context, logon_name->account_name, KRB5_PRINCIPAL_PARSE_NO_REALM, + ret = krb5_parse_name_flags(context, logon_name->account_name, KRB5_PRINCIPAL_PARSE_NO_REALM, &client_principal_pac); if (ret) { - DEBUG(2, ("Could not parse name from incoming PAC: [%s]: %s\n", - logon_name->account_name, + DEBUG(2, ("Could not parse name from incoming PAC: [%s]: %s\n", + logon_name->account_name, smb_get_krb5_error_message(context, ret, mem_ctx))); if (k5ret) { *k5ret = ret; @@ -319,20 +319,20 @@ krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, } if (!krb5_principal_compare_any_realm(context, client_principal, client_principal_pac)) { - DEBUG(2, ("Name in PAC [%s] does not match principal name in ticket\n", + DEBUG(2, ("Name in PAC [%s] does not match principal name in ticket\n", logon_name->account_name)); return NT_STATUS_ACCESS_DENIED; } - + #if 0 - if (strcasecmp(logon_info->info3.base.account_name.string, + if (strcasecmp(logon_info->info3.base.account_name.string, "Administrator")== 0) { file_save("tmp_pac_data-admin.dat",blob.data,blob.length); } #endif DEBUG(3,("Found account name from PAC: %s [%s]\n", - logon_info->info3.base.account_name.string, + logon_info->info3.base.account_name.string, logon_info->info3.base.full_name.string)); *pac_data_out = pac_data; @@ -347,20 +347,20 @@ _PUBLIC_ NTSTATUS kerberos_pac_logon_info(TALLOC_CTX *mem_ctx, const krb5_keyblock *krbtgt_keyblock, const krb5_keyblock *service_keyblock, krb5_const_principal client_principal, - time_t tgs_authtime, + time_t tgs_authtime, krb5_error_code *k5ret) { NTSTATUS nt_status; struct PAC_DATA *pac_data; int i; - nt_status = kerberos_decode_pac(mem_ctx, + nt_status = kerberos_decode_pac(mem_ctx, iconv_convenience, &pac_data, blob, context, krbtgt_keyblock, service_keyblock, - client_principal, + client_principal, tgs_authtime, k5ret); if (!NT_STATUS_IS_OK(nt_status)) { @@ -372,7 +372,7 @@ _PUBLIC_ NTSTATUS kerberos_pac_logon_info(TALLOC_CTX *mem_ctx, if (pac_data->buffers[i].type != PAC_TYPE_LOGON_INFO) { continue; } - *logon_info = pac_data->buffers[i].info->logon_info.info; + *logon_info = pac_data->buffers[i].info->logon_info.info; } if (!*logon_info) { return NT_STATUS_INVALID_PARAMETER; @@ -380,7 +380,7 @@ _PUBLIC_ NTSTATUS kerberos_pac_logon_info(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, +static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, DATA_BLOB *pac_data, struct PAC_SIGNATURE_DATA *sig, krb5_context context, @@ -408,7 +408,7 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, pac_data->length, &cksum); if (ret) { - DEBUG(2, ("PAC Verification failed: %s\n", + DEBUG(2, ("PAC Verification failed: %s\n", smb_get_krb5_error_message(context, ret, mem_ctx))); } @@ -431,7 +431,7 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, krb5_context context, const krb5_keyblock *krbtgt_keyblock, const krb5_keyblock *service_keyblock, - DATA_BLOB *pac) + DATA_BLOB *pac) { NTSTATUS nt_status; krb5_error_code ret; @@ -447,28 +447,28 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, if (pac_data->buffers[i].type != PAC_TYPE_KDC_CHECKSUM) { continue; } - kdc_checksum = &pac_data->buffers[i].info->kdc_cksum, + kdc_checksum = &pac_data->buffers[i].info->kdc_cksum, ret = make_pac_checksum(mem_ctx, &zero_blob, - kdc_checksum, + kdc_checksum, context, krbtgt_keyblock); if (ret) { - DEBUG(2, ("making krbtgt PAC checksum failed: %s\n", + DEBUG(2, ("making krbtgt PAC checksum failed: %s\n", smb_get_krb5_error_message(context, ret, mem_ctx))); talloc_free(pac_data); return ret; } } - + for (i=0; i < pac_data->num_buffers; i++) { if (pac_data->buffers[i].type != PAC_TYPE_SRV_CHECKSUM) { continue; } - srv_checksum = &pac_data->buffers[i].info->srv_cksum; - ret = make_pac_checksum(mem_ctx, &zero_blob, - srv_checksum, + srv_checksum = &pac_data->buffers[i].info->srv_cksum; + ret = make_pac_checksum(mem_ctx, &zero_blob, + srv_checksum, context, service_keyblock); if (ret) { - DEBUG(2, ("making service PAC checksum failed: %s\n", + DEBUG(2, ("making service PAC checksum failed: %s\n", smb_get_krb5_error_message(context, ret, mem_ctx))); talloc_free(pac_data); return ret; @@ -488,7 +488,7 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, memset(kdc_checksum->signature.data, '\0', kdc_checksum->signature.length); memset(srv_checksum->signature.data, '\0', srv_checksum->signature.length); - ndr_err = ndr_push_struct_blob(&tmp_blob, mem_ctx, + ndr_err = ndr_push_struct_blob(&tmp_blob, mem_ctx, iconv_convenience, pac_data, (ndr_push_flags_fn_t)ndr_push_PAC_DATA); @@ -506,14 +506,14 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, /* Then sign Server checksum */ ret = make_pac_checksum(mem_ctx, &srv_checksum->signature, kdc_checksum, context, krbtgt_keyblock); if (ret) { - DEBUG(2, ("making krbtgt PAC checksum failed: %s\n", + DEBUG(2, ("making krbtgt PAC checksum failed: %s\n", smb_get_krb5_error_message(context, ret, mem_ctx))); talloc_free(pac_data); return ret; } /* And push it out again, this time to the world. This relies on determanistic pointer values */ - ndr_err = ndr_push_struct_blob(&tmp_blob, mem_ctx, + ndr_err = ndr_push_struct_blob(&tmp_blob, mem_ctx, iconv_convenience, pac_data, (ndr_push_flags_fn_t)ndr_push_PAC_DATA); @@ -552,7 +552,7 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, union PAC_INFO *u_SRV_CHECKSUM; char *name; - + enum { PAC_BUF_LOGON_INFO = 0, PAC_BUF_LOGON_NAME = 1, @@ -568,7 +568,7 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, pac_data->num_buffers = PAC_BUF_NUM_BUFFERS; pac_data->version = 0; - pac_data->buffers = talloc_array(pac_data, + pac_data->buffers = talloc_array(pac_data, struct PAC_BUFFER, pac_data->num_buffers); if (!pac_data->buffers) { @@ -630,7 +630,7 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, u_LOGON_INFO->logon_info.info = LOGON_INFO; LOGON_INFO->info3 = *sam3; - ret = krb5_unparse_name_flags(context, client_principal, + ret = krb5_unparse_name_flags(context, client_principal, KRB5_PRINCIPAL_UNPARSE_NO_REALM, &name); if (ret) { return ret; @@ -643,9 +643,9 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, */ unix_to_nt_time(&LOGON_NAME->logon_time, tgs_authtime); - ret = kerberos_encode_pac(mem_ctx, + ret = kerberos_encode_pac(mem_ctx, iconv_convenience, - pac_data, + pac_data, context, krbtgt_keyblock, service_keyblock, @@ -658,7 +658,7 @@ krb5_error_code kerberos_pac_to_server_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, krb5_pac pac, krb5_context context, - struct auth_serversupplied_info **server_info) + struct auth_serversupplied_info **server_info) { NTSTATUS nt_status; enum ndr_err_code ndr_err; @@ -701,12 +701,12 @@ krb5_error_code kerberos_pac_to_server_info(TALLOC_CTX *mem_ctx, nt_status = make_server_info_netlogon_validation(mem_ctx, "", 3, &validation, - &server_info_out); + &server_info_out); if (!NT_STATUS_IS_OK(nt_status)) { talloc_free(tmp_ctx); return EINVAL; } - + ret = krb5_pac_get_buffer(context, pac, PAC_TYPE_SRV_CHECKSUM, &k5pac_srv_checksum_in); if (ret != 0) { talloc_free(tmp_ctx); @@ -714,8 +714,8 @@ krb5_error_code kerberos_pac_to_server_info(TALLOC_CTX *mem_ctx, } pac_srv_checksum_in = data_blob_const(k5pac_srv_checksum_in.data, k5pac_srv_checksum_in.length); - - ndr_err = ndr_pull_struct_blob(&pac_srv_checksum_in, server_info_out, + + ndr_err = ndr_pull_struct_blob(&pac_srv_checksum_in, server_info_out, iconv_convenience, &server_info_out->pac_srv_sig, (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA); krb5_data_free(&k5pac_srv_checksum_in); @@ -733,8 +733,8 @@ krb5_error_code kerberos_pac_to_server_info(TALLOC_CTX *mem_ctx, } pac_kdc_checksum_in = data_blob_const(k5pac_kdc_checksum_in.data, k5pac_kdc_checksum_in.length); - - ndr_err = ndr_pull_struct_blob(&pac_kdc_checksum_in, server_info_out, + + ndr_err = ndr_pull_struct_blob(&pac_kdc_checksum_in, server_info_out, iconv_convenience, &server_info_out->pac_kdc_sig, (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA); krb5_data_free(&k5pac_kdc_checksum_in); @@ -746,21 +746,21 @@ krb5_error_code kerberos_pac_to_server_info(TALLOC_CTX *mem_ctx, } *server_info = server_info_out; - + return 0; } NTSTATUS kerberos_pac_blob_to_server_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, - DATA_BLOB pac_blob, + DATA_BLOB pac_blob, krb5_context context, - struct auth_serversupplied_info **server_info) + struct auth_serversupplied_info **server_info) { krb5_error_code ret; krb5_pac pac; - ret = krb5_pac_parse(context, - pac_blob.data, pac_blob.length, + ret = krb5_pac_parse(context, + pac_blob.data, pac_blob.length, &pac); if (ret) { return map_nt_error_from_unix(ret); |