nt_status = cli_full_connection(&c, myname, server, NULL, 0, share, "?????",
username, lp_workgroup(), password, 0);
- if (NT_STATUS_IS_OK(nt_status)) {
- return c;
- } else {
+ if (!NT_STATUS_IS_OK(nt_status)) {
fprintf(stderr, "ERROR: Connection failed with error %s\n", nt_errstr(nt_status));
return NULL;
}
-
- /*
- * Return the new connection...
- */
-
+ /*
+ * Return the new connection...
+ */
+
return (c);
}
else {
/* This would be the utf8-encoded version...*/
/* if (!(search_attrs = ads_push_strvals(ctx, attrs))) */
- if (!(str_list_copy(&search_attrs, (char **) attrs)))
+ if (!(str_list_copy(&search_attrs, attrs)))
{
rc = LDAP_NO_MEMORY;
goto done;
else {
/* This would be the utf8-encoded version...*/
/* if (!(search_attrs = ads_push_strvals(ctx, attrs))) */
- if (!(str_list_copy(&search_attrs, (char **) attrs)))
+ if (!(str_list_copy(&search_attrs, attrs)))
{
rc = LDAP_NO_MEMORY;
goto done;
if (plaintext) {
/* we have an ADS password - use that */
DEBUG(4,("Using ADS machine password\n"));
- E_md4hash((uchar *)plaintext, ret_pwd);
+ E_md4hash(plaintext, ret_pwd);
SAFE_FREE(plaintext);
return True;
}
***************************************************************************/
static void add_auto_printers(void)
{
- char *p;
+ const char *p;
int printers;
char *str = strdup(lp_auto_services());
printers = lp_servicenumber(PRINTERS_NAME);
if (printers < 0) {
- SAFE_FREE(str);
- return;
- }
+ SAFE_FREE(str);
+ return;
+ }
for (p=strtok(str,LIST_SEP);p;p=strtok(NULL,LIST_SEP)) {
if (lp_servicenumber(p) >= 0) continue;
Scan printcap file pszPrintcapname for a printer called pszPrintername.
Return True if found, else False. Returns False on error, too, after logging
the error at level 0. For generality, the printcap name may be passed - if
-passed as NULL, the configuration will be queried for the name. pszPrintername
-must be in DOS codepage.
-The xxx_printername_ok functions need fixing to understand they are being
-given a DOS codepage. FIXME !! JRA.
+passed as NULL, the configuration will be queried for the name.
***************************************************************************/
-BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname)
+BOOL pcap_printername_ok(const char *pszPrintername, const char *pszPrintcapname)
{
char *line=NULL;
char *psz;
if (strequal(p,pszPrintername))
{
- /* normalise the case */
- pstrcpy(pszPrintername,p);
SAFE_FREE(line);
x_fclose(pfile);
return(True);
* provide the equivalent of pcap_printername_ok() for SVID/XPG4 conforming
* systems.
*/
-int sysv_printername_ok(char *name)
+int sysv_printername_ok(const char *name)
{
printer_t *tmp;
time_t u_logout;
NTTIME nt_logout;
+ uint32 account_policy_temp;
+
uint32 num_users=0, num_groups=0, num_aliases=0;
if ((ctr = (SAM_UNK_CTR *)talloc_zero(p->mem_ctx, sizeof(SAM_UNK_CTR))) == NULL)
switch (q_u->switch_value) {
case 0x01:
- account_policy_get(AP_MIN_PASSWORD_LEN, &min_pass_len);
- account_policy_get(AP_PASSWORD_HISTORY, &pass_hist);
- account_policy_get(AP_USER_MUST_LOGON_TO_CHG_PASS, &flag);
- account_policy_get(AP_MAX_PASSWORD_AGE, (int *)&u_expire);
- account_policy_get(AP_MIN_PASSWORD_AGE, (int *)&u_min_age);
+
+ account_policy_get(AP_MIN_PASSWORD_LEN, &account_policy_temp);
+ min_pass_len = account_policy_temp;
+
+ account_policy_get(AP_PASSWORD_HISTORY, &account_policy_temp);
+ pass_hist = account_policy_temp;
+
+ account_policy_get(AP_USER_MUST_LOGON_TO_CHG_PASS, &account_policy_temp);
+ flag = account_policy_temp;
+ account_policy_get(AP_MAX_PASSWORD_AGE, &account_policy_temp);
+ u_expire = account_policy_temp;
+
+ account_policy_get(AP_MIN_PASSWORD_AGE, &account_policy_temp);
+ u_min_age = account_policy_temp;
+
unix_to_nt_time_abs(&nt_expire, u_expire);
unix_to_nt_time_abs(&nt_min_age, u_min_age);
init_unk_info7(&ctr->info.inf7);
break;
case 0x0c:
- account_policy_get(AP_LOCK_ACCOUNT_DURATION, (int *)&u_lock_duration);
- account_policy_get(AP_RESET_COUNT_TIME, (int *)&u_reset_time);
- account_policy_get(AP_BAD_ATTEMPT_LOCKOUT, &lockout);
-
+ account_policy_get(AP_LOCK_ACCOUNT_DURATION, &account_policy_temp);
+ u_lock_duration = account_policy_temp;
+
+ account_policy_get(AP_RESET_COUNT_TIME, &account_policy_temp);
+ u_reset_time = account_policy_temp;
+
+ account_policy_get(AP_BAD_ATTEMPT_LOCKOUT, &account_policy_temp);
+ lockout = account_policy_temp;
+
unix_to_nt_time_abs(&nt_lock_duration, u_lock_duration);
unix_to_nt_time_abs(&nt_reset_time, u_reset_time);
fstring domain;
uint32 num_rids, *name_types, *user_rids;
uint32 flags = 0x3e8;
- const char *acct_name;
-
+ char *acct_name;
+ const char *const_acct_name;
+
/* Connect to remote machine */
if (!(cli = net_make_ipc_connection(NET_FLAGS_PDC)))
CHECK_RPC_ERR_DEBUG(cli_samr_lookup_names(cli, mem_ctx,
&domain_pol, flags,
- 1, &acct_name, &num_rids,
+ 1, &const_acct_name,
+ &num_rids,
&user_rids, &name_types),
("error looking up rid for user %s: %s\n",
acct_name, nt_errstr(result)));