summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-08-31 19:04:51 +0000
committerJeremy Allison <jra@samba.org>2000-08-31 19:04:51 +0000
commitfa810d4c8001c10bddce452b4ab1178eb80dee87 (patch)
tree59edc49534184b4b766e65e416630a2a2763f16d /source3/printing
parent288ea15a564e0931f8002cfb2ca3b4064bb4c227 (diff)
downloadsamba-fa810d4c8001c10bddce452b4ab1178eb80dee87.tar.gz
samba-fa810d4c8001c10bddce452b4ab1178eb80dee87.tar.bz2
samba-fa810d4c8001c10bddce452b4ab1178eb80dee87.zip
Implemented DELETEFORM tested using Gerald's Win32 test code :-).
Jeremy. (This used to be commit 596c21a2af0309ce43a5e52a343a671036d05ebf)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 1dfced705b..05ab71d178 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -155,7 +155,7 @@ BOOL add_a_form(nt_forms_struct **list, const FORM *form, int *count)
update=False;
- unistr2_to_ascii(form_name, &(form->name), sizeof(form_name)-1);
+ unistr2_to_ascii(form_name, &form->name, sizeof(form_name)-1);
for (n=0; n<*count && update==False; n++)
{
if (!strncmp((*list)[n].name, form_name, strlen(form_name)))
@@ -169,7 +169,7 @@ BOOL add_a_form(nt_forms_struct **list, const FORM *form, int *count)
{
if((*list=Realloc(*list, (n+1)*sizeof(nt_forms_struct))) == NULL)
return False;
- unistr2_to_ascii((*list)[n].name, &(form->name), sizeof((*list)[n].name)-1);
+ unistr2_to_ascii((*list)[n].name, &form->name, sizeof((*list)[n].name)-1);
(*count)++;
}
@@ -185,6 +185,53 @@ BOOL add_a_form(nt_forms_struct **list, const FORM *form, int *count)
}
/****************************************************************************
+ delete a named form struct
+****************************************************************************/
+BOOL delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, uint32 *ret)
+{
+ pstring key;
+ TDB_DATA kbuf;
+ int n=0;
+ fstring form_name;
+
+ *ret = 0;
+
+ if (*count == 1) {
+ /*
+ * Don't delete the last form (no empty lists).
+ * CHECKME ! Is this correct ? JRA.
+ */
+ *ret = ERROR_INVALID_PARAMETER;
+ return False;
+ }
+
+ unistr2_to_ascii(form_name, del_name, sizeof(form_name)-1);
+
+ for (n=0; n<*count; n++) {
+ if (!strncmp((*list)[n].name, form_name, strlen(form_name))) {
+ DEBUG(103, ("delete_a_form, [%s] in list\n", form_name));
+ break;
+ }
+ }
+
+ if (n == *count) {
+ DEBUG(10,("delete_a_form, [%s] not found\n", form_name));
+ *ret = ERROR_INVALID_PARAMETER;
+ return False;
+ }
+
+ slprintf(key, sizeof(key), "%s%s", FORMS_PREFIX, (*list)[n].name);
+ kbuf.dsize = strlen(key)+1;
+ kbuf.dptr = key;
+ if (tdb_delete(tdb, kbuf) != 0) {
+ *ret = ERROR_NOT_ENOUGH_MEMORY;
+ return False;
+ }
+
+ return True;
+}
+
+/****************************************************************************
update a form struct
****************************************************************************/
void update_a_form(nt_forms_struct **list, const FORM *form, int count)