diff options
author | Jeremy Allison <jra@samba.org> | 2002-11-12 23:20:50 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-11-12 23:20:50 +0000 |
commit | 2f194322d419350f35a48dff750066894d68eccf (patch) | |
tree | b0501eaf874ca8e740a51a8e0f29d261e32e0093 /source3/libads | |
parent | f2b669b37fecda2687860eba4a15801dc89855dc (diff) | |
download | samba-2f194322d419350f35a48dff750066894d68eccf.tar.gz samba-2f194322d419350f35a48dff750066894d68eccf.tar.bz2 samba-2f194322d419350f35a48dff750066894d68eccf.zip |
Removed global_myworkgroup, global_myname, global_myscope. Added liberal
dashes of const. This is a rather large check-in, some things may break.
It does compile though :-).
Jeremy.
(This used to be commit f755711df8f74f9b8e8c1a2b0d07d02a931eeb89)
Diffstat (limited to 'source3/libads')
-rw-r--r-- | source3/libads/kerberos_verify.c | 3 | ||||
-rw-r--r-- | source3/libads/ldap.c | 38 | ||||
-rw-r--r-- | source3/libads/ldap_printer.c | 9 | ||||
-rw-r--r-- | source3/libads/sasl.c | 3 |
4 files changed, 26 insertions, 27 deletions
diff --git a/source3/libads/kerberos_verify.c b/source3/libads/kerberos_verify.c index 22b58f47dd..f761467d6f 100644 --- a/source3/libads/kerberos_verify.c +++ b/source3/libads/kerberos_verify.c @@ -42,7 +42,6 @@ NTSTATUS ads_verify_ticket(ADS_STRUCT *ads, const DATA_BLOB *ticket, krb5_keyblock * key; krb5_principal host_princ; char *host_princ_s; - extern pstring global_myname; fstring myname; char *password_s; krb5_data password; @@ -83,7 +82,7 @@ NTSTATUS ads_verify_ticket(ADS_STRUCT *ads, const DATA_BLOB *ticket, return NT_STATUS_LOGON_FAILURE; } - fstrcpy(myname, global_myname); + fstrcpy(myname, global_myname()); strlower(myname); asprintf(&host_princ_s, "HOST/%s@%s", myname, lp_realm()); ret = krb5_parse_name(context, host_princ_s, &host_princ); diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index a59b78bf13..d5cd56001b 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -105,26 +105,28 @@ static int ldap_ip_compare(struct ldap_ip *ip1, struct ldap_ip *ip2) /* try connecting to a ldap server via DNS */ static BOOL ads_try_dns(ADS_STRUCT *ads) { - char *realm, *ptr; + const char *c_realm; + const char *ptr; + char *realm; char *list = NULL; pstring tok; struct ldap_ip *ip_list; int count, i=0; - realm = ads->server.realm; - if (!realm || !*realm) { - realm = lp_realm(); + c_realm = ads->server.realm; + if (!c_realm || !*c_realm) { + c_realm = lp_realm(); } - if (!realm || !*realm) { - realm = ads->server.workgroup; + if (!c_realm || !*c_realm) { + c_realm = ads->server.workgroup; } - if (!realm || !*realm) { - realm = lp_workgroup(); + if (!c_realm || !*c_realm) { + c_realm = lp_workgroup(); } - if (!realm) { + if (!c_realm) { return False; } - realm = smb_xstrdup(realm); + realm = smb_xstrdup(c_realm); DEBUG(6,("ads_try_dns: looking for realm '%s'\n", realm)); if (ldap_domain2hostlist(realm, &list) != LDAP_SUCCESS) { @@ -183,7 +185,7 @@ static BOOL ads_try_netbios(ADS_STRUCT *ads) struct in_addr *ip_list, pdc_ip; int count; int i; - char *workgroup = ads->server.workgroup; + const char *workgroup = ads->server.workgroup; if (!workgroup) { workgroup = lp_workgroup(); @@ -273,9 +275,8 @@ got_connection: if (!ads->auth.user_name) { /* by default use the machine account */ - extern pstring global_myname; fstring myname; - fstrcpy(myname, global_myname); + fstrcpy(myname, global_myname()); strlower(myname); asprintf(&ads->auth.user_name, "HOST/%s", myname); } @@ -435,8 +436,7 @@ ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path, else { /* This would be the utf8-encoded version...*/ /* if (!(search_attrs = ads_push_strvals(ctx, attrs))) */ - if (!(str_list_copy(&search_attrs, attrs))) - { + if (!(str_list_copy(&search_attrs, attrs))) { rc = LDAP_NO_MEMORY; goto done; } @@ -1026,7 +1026,8 @@ static ADS_STATUS ads_add_machine_acct(ADS_STRUCT *ads, const char *hostname, ADS_MODLIST mods; const char *objectClass[] = {"top", "person", "organizationalPerson", "user", "computer", NULL}; - char *servicePrincipalName[3] = {NULL, NULL, NULL}; + const char *servicePrincipalName[3] = {NULL, NULL, NULL}; + char *psp; unsigned acct_control; if (!(ctx = talloc_init_named("machine_account"))) @@ -1046,10 +1047,11 @@ static ADS_STATUS ads_add_machine_acct(ADS_STRUCT *ads, const char *hostname, new_dn = talloc_asprintf(ctx, "cn=%s,%s,%s", hostname, ou_str, ads->config.bind_path); servicePrincipalName[0] = talloc_asprintf(ctx, "HOST/%s", hostname); - servicePrincipalName[1] = talloc_asprintf(ctx, "HOST/%s.%s", + psp = talloc_asprintf(ctx, "HOST/%s.%s", hostname, ads->config.realm); - strlower(&servicePrincipalName[1][5]); + strlower(&psp[5]); + servicePrincipalName[1] = psp; free(ou_str); if (!new_dn) diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c index 66984477b8..0185bf7811 100644 --- a/source3/libads/ldap_printer.c +++ b/source3/libads/ldap_printer.c @@ -28,7 +28,7 @@ results can be used. It should be freed using ads_msgfree. */ ADS_STATUS ads_find_printer_on_server(ADS_STRUCT *ads, void **res, - const char *printer, char *servername) + const char *printer, const char *servername) { ADS_STATUS status; char *srv_dn, **srv_cn, *exp; @@ -77,7 +77,7 @@ ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn, ads_mod_str(ctx, &mods, "versionNumber", prt->versionNumber); /* now the optional ones */ - ads_mod_strlist(ctx, &mods, "description", prt->description); + ads_mod_strlist(ctx, &mods, "description", (const char **)prt->description); ads_mod_str(ctx, &mods, "assetNumber",prt->assetNumber); ads_mod_str(ctx, &mods, "bytesPerMinute",prt->bytesPerMinute); ads_mod_str(ctx, &mods, "defaultPriority",prt->defaultPriority); @@ -93,10 +93,10 @@ ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn, prt->operatingSystemVersion); ads_mod_str(ctx, &mods, "physicalLocationObject", prt->physicalLocationObject); - ads_mod_strlist(ctx, &mods, "portName", prt->portName); + ads_mod_strlist(ctx, &mods, "portName", (const char **)prt->portName); ads_mod_str(ctx, &mods, "printStartTime", prt->printStartTime); ads_mod_str(ctx, &mods, "printEndTime", prt->printEndTime); - ads_mod_strlist(ctx, &mods, "printBinNames", prt->printBinNames); + ads_mod_strlist(ctx, &mods, "printBinNames", (const char **)prt->printBinNames); /*... and many others */ /* do the ldap modify */ @@ -107,7 +107,6 @@ ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn, return status; } - /* add a printer to the directory diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c index 16ad397d0e..7aa77bf2a2 100644 --- a/source3/libads/sasl.c +++ b/source3/libads/sasl.c @@ -36,7 +36,6 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads) uint32 neg_flags; struct berval cred, *scred; ADS_STATUS status; - extern pstring global_myname; int rc; if (!ads->auth.password) { @@ -97,7 +96,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads) nthash, 24, lp_workgroup(), ads->auth.user_name, - global_myname, + global_myname(), sess_key, 16, neg_flags); |