Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source4/auth/credentials/credentials.c

    r414 r745  
    2525#include "librpc/gen_ndr/samr.h" /* for struct samrPassword */
    2626#include "auth/credentials/credentials.h"
    27 #include "auth/credentials/credentials_krb5.h"
    28 #include "auth/credentials/credentials_proto.h"
    2927#include "libcli/auth/libcli_auth.h"
    3028#include "lib/events/events.h"
    3129#include "param/param.h"
     30
    3231
    3332/**
     
    3837{
    3938        struct cli_credentials *cred = talloc(mem_ctx, struct cli_credentials);
    40         if (!cred) {
     39        if () {
    4140                return cred;
    4241        }
    4342
    44         cred->netlogon_creds = NULL;
    45         cred->machine_account_pending = false;
    4643        cred->workstation_obtained = CRED_UNINITIALISED;
    4744        cred->username_obtained = CRED_UNINITIALISED;
     
    5148        cred->ccache_obtained = CRED_UNINITIALISED;
    5249        cred->client_gss_creds_obtained = CRED_UNINITIALISED;
     50
     51
    5352        cred->server_gss_creds_obtained = CRED_UNINITIALISED;
    54         cred->keytab_obtained = CRED_UNINITIALISED;
    55         cred->principal_obtained = CRED_UNINITIALISED;
    5653
    5754        cred->ccache_threshold = CRED_UNINITIALISED;
    5855        cred->client_gss_creds_threshold = CRED_UNINITIALISED;
    5956
     57
     58
     59
    6060        cred->old_password = NULL;
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
    6198        cred->smb_krb5_context = NULL;
    62         cred->salt_principal = NULL;
     99
     100        cred->machine_account_pending = false;
     101        cred->machine_account_pending_lp_ctx = NULL;
     102
    63103        cred->machine_account = false;
    64104
    65         cred->bind_dn = NULL;
    66 
    67105        cred->tries = 3;
     106
    68107        cred->callback_running = false;
    69108
    70109        cli_credentials_set_kerberos_state(cred, CRED_AUTO_USE_KERBEROS);
    71110        cli_credentials_set_gensec_features(cred, 0);
     111
    72112
    73113        return cred;
     
    94134}
    95135
     136
     137
     138
     139
     140
     141
    96142_PUBLIC_ enum credentials_use_kerberos cli_credentials_get_kerberos_state(struct cli_credentials *creds)
    97143{
    98144        return creds->use_kerberos;
     145
     146
     147
     148
     149
    99150}
    100151
     
    185236 * @note Return value will never be NULL except by programmer error.
    186237 */
    187 _PUBLIC_ const char *cli_credentials_get_principal(struct cli_credentials *cred, TALLOC_CTX *mem_ctx)
     238)
    188239{
    189240        if (cred->machine_account_pending) {
     
    201252        }
    202253
    203         if (cred->principal_obtained < cred->username_obtained) {
     254        if (cred->principal_obtained < cred->username_obtained
     255            || cred->principal_obtained < MAX(cred->domain_obtained, cred->realm_obtained)) {
    204256                if (cred->domain_obtained > cred->realm_obtained) {
     257
    205258                        return talloc_asprintf(mem_ctx, "%s@%s",
    206259                                               cli_credentials_get_username(cred),
    207260                                               cli_credentials_get_domain(cred));
    208261                } else {
     262
    209263                        return talloc_asprintf(mem_ctx, "%s@%s",
    210264                                               cli_credentials_get_username(cred),
     
    212266                }
    213267        }
     268
    214269        return talloc_reference(mem_ctx, cred->principal);
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
    215282}
    216283
     
    614681{
    615682        cli_credentials_set_username(cred, "", CRED_UNINITIALISED);
    616         cli_credentials_set_domain(cred, lp_workgroup(lp_ctx), CRED_UNINITIALISED);
    617         cli_credentials_set_workstation(cred, lp_netbios_name(lp_ctx), CRED_UNINITIALISED);
    618         cli_credentials_set_realm(cred, lp_realm(lp_ctx), CRED_UNINITIALISED);
     683        cli_credentials_set_domain(cred, lp_workgroup(lp_ctx), CRED_UNINITIALISED);
     684        cli_credentials_set_workstation(cred, lp_netbios_name(lp_ctx), CRED_UNINITIALISED);
     685        cli_credentials_set_realm(cred, lp_realm(lp_ctx), CRED_UNINITIALISED);
    619686}
    620687
     
    629696{
    630697        char *p;
     698
    631699
    632700        if (lp_ctx != NULL) {
     
    660728       
    661729        if (cli_credentials_get_kerberos_state(cred) != CRED_DONT_USE_KERBEROS) {
    662                 cli_credentials_set_ccache(cred, event_context_find(cred), lp_ctx, NULL, CRED_GUESS_FILE);
     730                cli_credentials_set_ccache(cred, lp_ctx, NULL, CRED_GUESS_FILE,
     731                                           &error_string);
    663732        }
    664733}
     
    691760{
    692761        cred->secure_channel_type = secure_channel_type;
     762
     763
     764
     765
     766
     767
     768
     769
     770
     771
     772
     773
     774
     775
     776
     777
     778
     779
     780
    693781}
    694782
     
    723811        const char *username;
    724812       
     813
     814
     815
     816
     817
    725818        if (cred->machine_account_pending) {
    726819                cli_credentials_set_machine_account(cred,
     
    760853        return (cred->tries > 0);
    761854}
     855
     856
     857
     858
     859
     860
     861
     862
     863
     864
     865
     866
     867
     868
     869
     870
     871
     872
     873
     874
     875
     876
     877
     878
     879
     880
     881
     882
     883
     884
     885
     886
     887
     888
     889
     890
     891
     892
     893
     894
     895
     896
     897
     898
     899
     900
     901
     902
     903
     904
     905
     906
     907
     908
     909
     910
     911
     912
     913
     914
     915
     916
     917
     918
     919
     920
     921
     922
     923
     924
     925
     926
     927
     928
     929
     930
     931
     932
     933
     934
     935
     936
     937
     938
     939
     940
     941
     942
     943
     944
     945
     946
     947
     948
     949
     950
     951
     952
     953
     954
     955
     956
     957
     958
     959
     960
     961
     962
     963
     964
     965
     966
     967
     968
     969
     970
     971
     972
     973
     974
     975
     976
     977
     978
     979
     980
     981
     982
     983
     984
     985
     986
     987
     988
     989
     990
     991
     992
     993
     994
     995
     996
     997
     998
     999
     1000
Note: See TracChangeset for help on using the changeset viewer.