From ad6dfee7413756b7fe76ce1c9440105edd2fe9b2 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Mon, 11 Feb 2002 15:48:01 +0000 Subject: Update for new ads modlist structure passing (This used to be commit 6169b668fe955f298c7323c5d64f6c7b303aaac0) --- source3/libads/ldap_printer.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'source3') diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c index d337398158..50f4302201 100644 --- a/source3/libads/ldap_printer.c +++ b/source3/libads/ldap_printer.c @@ -57,11 +57,11 @@ ADS_STATUS ads_find_printer_on_server(ADS_STRUCT *ads, void **res, ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn, const ADS_PRINTER_ENTRY *prt) { - void **mods; + ADS_MODLIST *mods; ADS_STATUS status; /* allocate the list */ - mods = ads_init_mods(sizeof(ADS_PRINTER_ENTRY) / sizeof(char *)); + *mods = ads_init_mods(); /* add the attributes to the list - required ones first */ ads_mod_repl(mods, "printerName", prt->printerName); @@ -93,10 +93,10 @@ ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn, /*... and many others */ /* do the ldap modify */ - status = ads_gen_mod(ads, prt_dn, mods); + status = ads_gen_mod(ads, prt_dn, *mods); /* free mod list, mods, and values */ - ads_free_mods(mods); + ads_free_mods(*mods); return status; } @@ -164,7 +164,16 @@ ADS_STATUS ads_add_printer(ADS_STRUCT *ads, const ADS_PRINTER_ENTRY *prt) } } - status = ads_mod_printer_entry(ads, prt_dn, prt); + status = ads_search_dn(ads, &res, prt_dn, attrs); + + if (ADS_ERR_OK(status) && ads_count_replies(ads, res)) { + /* need to retrieve GUID from results + prt->GUID */ + status = ads_mod_printer_entry(ads, prt_dn, prt); + } + + ads_msgfree(ads, res); + return status; } -- cgit