diff options
author | Jeremy Allison <jra@samba.org> | 2001-04-03 22:41:31 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-04-03 22:41:31 +0000 |
commit | da8731e271c4c8fc432a9ea4a2c79cb400f27a79 (patch) | |
tree | 04b803ec7c3c5887fdf093cd524e797aea4020b2 /source3 | |
parent | a6d201a8d7307f8a6342ee131917d6245ab41993 (diff) | |
download | samba-da8731e271c4c8fc432a9ea4a2c79cb400f27a79.tar.gz samba-da8731e271c4c8fc432a9ea4a2c79cb400f27a79.tar.bz2 samba-da8731e271c4c8fc432a9ea4a2c79cb400f27a79.zip |
Sync up with new NT forms code.
Jeremy.
(This used to be commit 63ce316d870be0cf61ae669c955479ec175fdaef)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 42 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 175 |
2 files changed, 197 insertions, 20 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 1d75877547..69aabab485 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -294,6 +294,46 @@ int sys_acl_set_file(char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d); int sys_acl_set_fd(int fd, SMB_ACL_T acl_d); int sys_acl_free_text(char *text); int sys_acl_free_acl(SMB_ACL_T acl_d) ; +int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p); +int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p); +int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p); +void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d); +SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type); +SMB_ACL_T sys_acl_get_fd(int fd); +int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d); +int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm); +int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm); +char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p); +SMB_ACL_T sys_acl_init(int count); +int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p); +int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type); +int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p); +int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d); +int sys_acl_valid(SMB_ACL_T acl_d); +int sys_acl_set_file(char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d); +int sys_acl_set_fd(int fd, SMB_ACL_T acl_d); +int sys_acl_free_text(char *text); +int sys_acl_free_acl(SMB_ACL_T acl_d) ; +int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p); +SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type); +SMB_ACL_T sys_acl_get_fd(int fd); +char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen); +int sys_acl_valid( SMB_ACL_T theacl ); +int sys_acl_set_file( char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl); +int sys_acl_set_fd( int fd, SMB_ACL_T theacl); +int sys_acl_create_entry( SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p); +int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p); +int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p); +void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d); +int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset); +int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm); +int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm); +SMB_ACL_T sys_acl_init( int count); +int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type); +int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry_d, void *qual_p); +int sys_acl_set_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d); +int sys_acl_free_text(char *text); +int sys_acl_free_acl(SMB_ACL_T the_acl) ; int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p); int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p); int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p); @@ -2003,6 +2043,8 @@ BOOL parse_lpq_entry(int snum,char *line, /*The following definitions come from printing/nt_printing.c */ BOOL nt_printing_init(void); +int get_builtin_ntforms(nt_forms_struct **list); +BOOL get_a_builtin_ntform(UNISTR2 *uni_formname,nt_forms_struct *form); int get_ntforms(nt_forms_struct **list); int write_ntforms(nt_forms_struct **list, int number); BOOL add_a_form(nt_forms_struct **list, const FORM *form, int *count); diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 67ac3819ba..ccef9bf656 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -49,6 +49,125 @@ array index). Letter is always first, so (for the current code) additions always put things in the correct order. */ static nt_forms_struct default_forms[] = { {"Letter", 0x2, 0x34b5b, 0x44367, 0x0, 0x0, 0x34b5b, 0x44367}, + + {"Letter",0x1,0x34b5c,0x44368,0x0,0x0,0x34b5c,0x44368}, + {"Letter Small",0x1,0x34b5c,0x44368,0x0,0x0,0x34b5c,0x44368}, + {"Tabloid",0x1,0x44368,0x696b8,0x0,0x0,0x44368,0x696b8}, + {"Ledger",0x1,0x696b8,0x44368,0x0,0x0,0x696b8,0x44368}, + {"Legal",0x1,0x34b5c,0x56d10,0x0,0x0,0x34b5c,0x56d10}, + {"Statement",0x1,0x221b4,0x34b5c,0x0,0x0,0x221b4,0x34b5c}, + {"Executive",0x1,0x2cf56,0x411cc,0x0,0x0,0x2cf56,0x411cc}, + {"A3",0x1,0x48828,0x668a0,0x0,0x0,0x48828,0x668a0}, + {"A4",0x1,0x33450,0x48828,0x0,0x0,0x33450,0x48828}, + {"A4 Small",0x1,0x33450,0x48828,0x0,0x0,0x33450,0x48828}, + {"A5",0x1,0x24220,0x33450,0x0,0x0,0x24220,0x33450}, + {"B4 (JIS)",0x1,0x3ebe8,0x58de0,0x0,0x0,0x3ebe8,0x58de0}, + {"B5 (JIS)",0x1,0x2c6f0,0x3ebe8,0x0,0x0,0x2c6f0,0x3ebe8}, + {"Folio",0x1,0x34b5c,0x509d8,0x0,0x0,0x34b5c,0x509d8}, + {"Quarto",0x1,0x347d8,0x43238,0x0,0x0,0x347d8,0x43238}, + {"10x14",0x1,0x3e030,0x56d10,0x0,0x0,0x3e030,0x56d10}, + {"11x17",0x1,0x44368,0x696b8,0x0,0x0,0x44368,0x696b8}, + {"Note",0x1,0x34b5c,0x44368,0x0,0x0,0x34b5c,0x44368}, + {"Envelope #9",0x1,0x18079,0x37091,0x0,0x0,0x18079,0x37091}, + {"Envelope #10",0x1,0x19947,0x3ae94,0x0,0x0,0x19947,0x3ae94}, + {"Envelope #11",0x1,0x1be7c,0x40565,0x0,0x0,0x1be7c,0x40565}, + {"Envelope #12",0x1,0x1d74a,0x44368,0x0,0x0,0x1d74a,0x44368}, + {"Envelope #14",0x1,0x1f018,0x47504,0x0,0x0,0x1f018,0x47504}, + {"C size sheet",0x1,0x696b8,0x886d0,0x0,0x0,0x696b8,0x886d0}, + {"D size sheet",0x1,0x886d0,0xd2d70,0x0,0x0,0x886d0,0xd2d70}, + {"E size sheet",0x1,0xd2d70,0x110da0,0x0,0x0,0xd2d70,0x110da0}, + {"Envelope DL",0x1,0x1adb0,0x35b60,0x0,0x0,0x1adb0,0x35b60}, + {"Envelope C5",0x1,0x278d0,0x37e88,0x0,0x0,0x278d0,0x37e88}, + {"Envelope C3",0x1,0x4f1a0,0x6fd10,0x0,0x0,0x4f1a0,0x6fd10}, + {"Envelope C4",0x1,0x37e88,0x4f1a0,0x0,0x0,0x37e88,0x4f1a0}, + {"Envelope C6",0x1,0x1bd50,0x278d0,0x0,0x0,0x1bd50,0x278d0}, + {"Envelope C65",0x1,0x1bd50,0x37e88,0x0,0x0,0x1bd50,0x37e88}, + {"Envelope B4",0x1,0x3d090,0x562e8,0x0,0x0,0x3d090,0x562e8}, + {"Envelope B5",0x1,0x2af80,0x3d090,0x0,0x0,0x2af80,0x3d090}, + {"Envelope B6",0x1,0x2af80,0x1e848,0x0,0x0,0x2af80,0x1e848}, + {"Envelope",0x1,0x1adb0,0x38270,0x0,0x0,0x1adb0,0x38270}, + {"Envelope Monarch",0x1,0x18079,0x2e824,0x0,0x0,0x18079,0x2e824}, + {"6 3/4 Envelope",0x1,0x167ab,0x284ec,0x0,0x0,0x167ab,0x284ec}, + {"US Std Fanfold",0x1,0x5c3e1,0x44368,0x0,0x0,0x5c3e1,0x44368}, + {"German Std Fanfold",0x1,0x34b5c,0x4a6a0,0x0,0x0,0x34b5c,0x4a6a0}, + {"German Legal Fanfold",0x1,0x34b5c,0x509d8,0x0,0x0,0x34b5c,0x509d8}, + {"B4 (ISO)",0x1,0x3d090,0x562e8,0x0,0x0,0x3d090,0x562e8}, + {"Japanese Postcard",0x1,0x186a0,0x24220,0x0,0x0,0x186a0,0x24220}, + {"9x11",0x1,0x37cf8,0x44368,0x0,0x0,0x37cf8,0x44368}, + {"10x11",0x1,0x3e030,0x44368,0x0,0x0,0x3e030,0x44368}, + {"15x11",0x1,0x5d048,0x44368,0x0,0x0,0x5d048,0x44368}, + {"Envelope Invite",0x1,0x35b60,0x35b60,0x0,0x0,0x35b60,0x35b60}, + {"Reserved48",0x1,0x1,0x1,0x0,0x0,0x1,0x1}, + {"Reserved49",0x1,0x1,0x1,0x0,0x0,0x1,0x1}, + {"Letter Extra",0x1,0x3ae94,0x4a6a0,0x0,0x0,0x3ae94,0x4a6a0}, + {"Legal Extra",0x1,0x3ae94,0x5d048,0x0,0x0,0x3ae94,0x5d048}, + {"Tabloid Extra",0x1,0x4a6a0,0x6f9f0,0x0,0x0,0x4a6a0,0x6f9f0}, + {"A4 Extra",0x1,0x397c2,0x4eb16,0x0,0x0,0x397c2,0x4eb16}, + {"Letter Transverse",0x1,0x34b5c,0x44368,0x0,0x0,0x34b5c,0x44368}, + {"A4 Transverse",0x1,0x33450,0x48828,0x0,0x0,0x33450,0x48828}, + {"Letter Extra Transverse",0x1,0x3ae94,0x4a6a0,0x0,0x0,0x3ae94,0x4a6a0}, + {"Super A",0x1,0x376b8,0x56ea0,0x0,0x0,0x376b8,0x56ea0}, + {"Super B",0x1,0x4a768,0x76e58,0x0,0x0,0x4a768,0x76e58}, + {"Letter Plus",0x1,0x34b5c,0x4eb16,0x0,0x0,0x34b5c,0x4eb16}, + {"A4 Plus",0x1,0x33450,0x50910,0x0,0x0,0x33450,0x50910}, + {"A5 Transverse",0x1,0x24220,0x33450,0x0,0x0,0x24220,0x33450}, + {"B5 (JIS) Transverse",0x1,0x2c6f0,0x3ebe8,0x0,0x0,0x2c6f0,0x3ebe8}, + {"A3 Extra",0x1,0x4e9d0,0x6ca48,0x0,0x0,0x4e9d0,0x6ca48}, + {"A5 Extra",0x1,0x2a7b0,0x395f8,0x0,0x0,0x2a7b0,0x395f8}, + {"B5 (ISO) Extra",0x1,0x31128,0x43620,0x0,0x0,0x31128,0x43620}, + {"A2",0x1,0x668a0,0x91050,0x0,0x0,0x668a0,0x91050}, + {"A3 Transverse",0x1,0x48828,0x668a0,0x0,0x0,0x48828,0x668a0}, + {"A3 Extra Transverse",0x1,0x4e9d0,0x6ca48,0x0,0x0,0x4e9d0,0x6ca48}, + {"Japanese Double Postcard",0x1,0x30d40,0x24220,0x0,0x0,0x30d40,0x24220}, + {"A6",0x1,0x19a28,0x24220,0x0,0x0,0x19a28,0x24220}, + {"Japanese Envelope Kaku #2",0x1,0x3a980,0x510e0,0x0,0x0,0x3a980,0x510e0}, + {"Japanese Envelope Kaku #3",0x1,0x34bc0,0x43a08,0x0,0x0,0x34bc0,0x43a08}, + {"Japanese Envelope Chou #3",0x1,0x1d4c0,0x395f8,0x0,0x0,0x1d4c0,0x395f8}, + {"Japanese Envelope Chou #4",0x1,0x15f90,0x320c8,0x0,0x0,0x15f90,0x320c8}, + {"Letter Rotated",0x1,0x44368,0x34b5c,0x0,0x0,0x44368,0x34b5c}, + {"A3 Rotated",0x1,0x668a0,0x48828,0x0,0x0,0x668a0,0x48828}, + {"A4 Rotated",0x1,0x48828,0x33450,0x0,0x0,0x48828,0x33450}, + {"A5 Rotated",0x1,0x33450,0x24220,0x0,0x0,0x33450,0x24220}, + {"B4 (JIS) Rotated",0x1,0x58de0,0x3ebe8,0x0,0x0,0x58de0,0x3ebe8}, + {"B5 (JIS) Rotated",0x1,0x3ebe8,0x2c6f0,0x0,0x0,0x3ebe8,0x2c6f0}, + {"Japanese Postcard Rotated",0x1,0x24220,0x186a0,0x0,0x0,0x24220,0x186a0}, + {"Double Japan Postcard Rotated",0x1,0x24220,0x30d40,0x0,0x0,0x24220,0x30d40}, + {"A6 Rotated",0x1,0x24220,0x19a28,0x0,0x0,0x24220,0x19a28}, + {"Japan Envelope Kaku #2 Rotated",0x1,0x510e0,0x3a980,0x0,0x0,0x510e0,0x3a980}, + {"Japan Envelope Kaku #3 Rotated",0x1,0x43a08,0x34bc0,0x0,0x0,0x43a08, 0x34bc0}, + {"Japan Envelope Chou #3 Rotated",0x1,0x395f8,0x1d4c0,0x0,0x0,0x395f8,0x1d4c0}, + {"Japan Envelope Chou #4 Rotated",0x1,0x320c8,0x15f90,0x0,0x0,0x320c8,0x15f90}, + {"B6 (JIS)",0x1,0x1f400,0x2c6f0,0x0,0x0,0x1f400,0x2c6f0}, + {"B6 (JIS) Rotated",0x1,0x2c6f0,0x1f400,0x0,0x0,0x2c6f0,0x1f400}, + {"12x11",0x1,0x4a724,0x443e1,0x0,0x0,0x4a724,0x443e1}, + {"Japan Envelope You #4",0x1,0x19a28,0x395f8,0x0,0x0,0x19a28,0x395f8}, + {"Japan Envelope You #4 Rotated",0x1,0x395f8,0x19a28,0x0,0x0,0x395f8,0x19a28}, + {"PRC 16K",0x1,0x2de60,0x3f7a0,0x0,0x0,0x2de60,0x3f7a0}, + {"PRC 32K",0x1,0x1fbd0,0x2cec0,0x0,0x0,0x1fbd0,0x2cec0}, + {"PRC 32K(Big)",0x1,0x222e0,0x318f8,0x0,0x0,0x222e0,0x318f8}, + {"PRC Envelope #1",0x1,0x18e70,0x28488,0x0,0x0,0x18e70,0x28488}, + {"PRC Envelope #2",0x1,0x18e70,0x2af80,0x0,0x0,0x18e70,0x2af80}, + {"PRC Envelope #3",0x1,0x1e848,0x2af80,0x0,0x0,0x1e848,0x2af80}, + {"PRC Envelope #4",0x1,0x1adb0,0x32c80,0x0,0x0,0x1adb0,0x32c80}, + {"PRC Envelope #5",0x1,0x1adb0,0x35b60,0x0,0x0,0x1adb0,0x35b60}, + {"PRC Envelope #6",0x1,0x1d4c0,0x38270,0x0,0x0,0x1d4c0,0x38270}, + {"PRC Envelope #7",0x1,0x27100,0x38270,0x0,0x0,0x27100,0x38270}, + {"PRC Envelope #8",0x1,0x1d4c0,0x4b708,0x0,0x0,0x1d4c0,0x4b708}, + {"PRC Envelope #9",0x1,0x37e88,0x4f1a0,0x0,0x0,0x37e88,0x4f1a0}, + {"PRC Envelope #10",0x1,0x4f1a0,0x6fd10,0x0,0x0,0x4f1a0,0x6fd10}, + {"PRC 16K Rotated",0x1,0x3f7a0,0x2de60,0x0,0x0,0x3f7a0,0x2de60}, + {"PRC 32K Rotated",0x1,0x2cec0,0x1fbd0,0x0,0x0,0x2cec0,0x1fbd0}, + {"PRC 32K(Big) Rotated",0x1,0x318f8,0x222e0,0x0,0x0,0x318f8,0x222e0}, + {"PRC Envelope #1 Rotated",0x1,0x28488,0x18e70,0x0,0x0,0x28488,0x18e70}, + {"PRC Envelope #2 Rotated",0x1,0x2af80,0x18e70,0x0,0x0,0x2af80,0x18e70}, + {"PRC Envelope #3 Rotated",0x1,0x2af80,0x1e848,0x0,0x0,0x2af80,0x1e848}, + {"PRC Envelope #4 Rotated",0x1,0x32c80,0x1adb0,0x0,0x0,0x32c80,0x1adb0}, + {"PRC Envelope #5 Rotated",0x1,0x35b60,0x1adb0,0x0,0x0,0x35b60,0x1adb0}, + {"PRC Envelope #6 Rotated",0x1,0x38270,0x1d4c0,0x0,0x0,0x38270,0x1d4c0}, + {"PRC Envelope #7 Rotated",0x1,0x38270,0x27100,0x0,0x0,0x38270,0x27100}, + {"PRC Envelope #8 Rotated",0x1,0x4b708,0x1d4c0,0x0,0x0,0x4b708,0x1d4c0}, + {"PRC Envelope #9 Rotated",0x1,0x4f1a0,0x37e88,0x0,0x0,0x4f1a0,0x37e88}, + {"PRC Envelope #10 Rotated",0x1,0x6fd10,0x4f1a0,0x0,0x0,0x6fd10,0x4f1a0} }; @@ -80,6 +199,36 @@ BOOL nt_printing_init(void) return True; } +/**************************************************************************** + get builtin form struct list +****************************************************************************/ +int get_builtin_ntforms(nt_forms_struct **list) +{ + *list = (nt_forms_struct *)memdup(&default_forms[0], sizeof(default_forms)); + return sizeof(default_forms) / sizeof(default_forms[0]); +} + +/**************************************************************************** + get a builtin form struct +****************************************************************************/ + +BOOL get_a_builtin_ntform(UNISTR2 *uni_formname,nt_forms_struct *form) +{ + int i,count; + fstring form_name; + unistr2_to_ascii(form_name, uni_formname, sizeof(form_name)-1); + DEBUGADD(6,("Looking for builtin form %s \n", form_name)); + count = sizeof(default_forms) / sizeof(default_forms[0]); + for (i=0;i<count;i++) { + if (strequal(form_name,default_forms[i].name)) { + DEBUGADD(6,("Found builtin form %s \n", form_name)); + memcpy(form,&default_forms[i],sizeof(*form)); + break; + } + } + + return (i !=count); +} /**************************************************************************** get a form struct list @@ -107,18 +256,13 @@ int get_ntforms(nt_forms_struct **list) safe_free(dbuf.dptr); if (ret != dbuf.dsize) continue; - /* allocate space and populate the list in correct order */ - if (i+1 > n) { - *list = Realloc(*list, sizeof(nt_forms_struct)*(i+1)); - n = i+1; + *list = Realloc(*list, sizeof(nt_forms_struct)*(n+1)); + if (!*list) { + DEBUG(0,("get_ntforms: Realloc fail.\n")); + return 0; } - (*list)[i] = form; - } - - /* we should never return a null forms list or NT gets unhappy */ - if (n == 0) { - *list = (nt_forms_struct *)memdup(&default_forms[0], sizeof(default_forms)); - n = sizeof(default_forms) / sizeof(default_forms[0]); + (*list)[n] = form; + n++; } @@ -210,15 +354,6 @@ BOOL delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, uint32 *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++) { |