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 2 of the License, or
+ 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,
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, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
if (ads_count_replies(ads, *res) != 1) {
return ADS_ERROR(LDAP_NO_SUCH_OBJECT);
}
- srv_dn = ldap_get_dn(ads->ld, *res);
+ srv_dn = ldap_get_dn(ads->ldap.ld, *res);
if (srv_dn == NULL) {
return ADS_ERROR(LDAP_NO_MEMORY);
}
/*
map a REG_SZ to an ldap mod
*/
-static BOOL map_sz(TALLOC_CTX *ctx, ADS_MODLIST *mods,
+static bool map_sz(TALLOC_CTX *ctx, ADS_MODLIST *mods,
const REGISTRY_VALUE *value)
{
char *str_value = NULL;
+ size_t converted_size;
ADS_STATUS status;
if (value->type != REG_SZ)
- return False;
+ return false;
if (value->size && *((smb_ucs2_t *) value->data_p)) {
- pull_ucs2_talloc(ctx, &str_value, (const smb_ucs2_t *) value->data_p);
+ if (!pull_ucs2_talloc(ctx, &str_value,
+ (const smb_ucs2_t *) value->data_p,
+ &converted_size))
+ {
+ return false;
+ }
status = ads_mod_str(ctx, mods, value->valuename, str_value);
return ADS_ERR_OK(status);
}
- return True;
+ return true;
}
/*
map a REG_DWORD to an ldap mod
*/
-static BOOL map_dword(TALLOC_CTX *ctx, ADS_MODLIST *mods,
+static bool map_dword(TALLOC_CTX *ctx, ADS_MODLIST *mods,
const REGISTRY_VALUE *value)
{
char *str_value = NULL;
/*
map a boolean REG_BINARY to an ldap mod
*/
-static BOOL map_bool(TALLOC_CTX *ctx, ADS_MODLIST *mods,
+static bool map_bool(TALLOC_CTX *ctx, ADS_MODLIST *mods,
const REGISTRY_VALUE *value)
{
char *str_value;
/*
map a REG_MULTI_SZ to an ldap mod
*/
-static BOOL map_multi_sz(TALLOC_CTX *ctx, ADS_MODLIST *mods,
+static bool map_multi_sz(TALLOC_CTX *ctx, ADS_MODLIST *mods,
const REGISTRY_VALUE *value)
{
char **str_values = NULL;
+ size_t converted_size;
smb_ucs2_t *cur_str = (smb_ucs2_t *) value->data_p;
uint32 size = 0, num_vals = 0, i=0;
ADS_STATUS status;
(num_vals + 1) * sizeof(char *));
cur_str = (smb_ucs2_t *) value->data_p;
- for (i=0; i < num_vals; i++)
+ for (i=0; i < num_vals; i++) {
cur_str += pull_ucs2_talloc(ctx, &str_values[i],
- cur_str);
+ cur_str, &converted_size) ?
+ converted_size : (size_t)-1;
+ }
status = ads_mod_strlist(ctx, mods, value->valuename,
(const char **) str_values);
struct valmap_to_ads {
const char *valname;
- BOOL (*fn)(TALLOC_CTX *, ADS_MODLIST *, const REGISTRY_VALUE *);
+ bool (*fn)(TALLOC_CTX *, ADS_MODLIST *, const REGISTRY_VALUE *);
};
/*
uint32 i;
POLICY_HND pol;
- asprintf(&servername, "\\\\%s", cli->cli->desthost);
- asprintf(&printername, "%s\\%s", servername, printer);
- if (!servername || !printername) {
+ if ((asprintf(&servername, "\\\\%s", cli->desthost) == -1)
+ || (asprintf(&printername, "%s\\%s", servername, printer) == -1)) {
DEBUG(3, ("Insufficient memory\n"));
return WERR_NOMEM;
}
result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
"", MAXIMUM_ALLOWED_ACCESS,
- servername, cli->cli->user_name, &pol);
+ servername, cli->auth->user_name,
+ &pol);
if (!W_ERROR_IS_OK(result)) {
DEBUG(3, ("Unable to open printer %s, error is %s.\n",
printername, dos_errstr(result)));
return result;
}
-BOOL get_local_printer_publishing_data(TALLOC_CTX *mem_ctx,
+bool get_local_printer_publishing_data(TALLOC_CTX *mem_ctx,
ADS_MODLIST *mods,
NT_PRINTER_DATA *data)
{