From fc89832192e4bf35b474f12bff6445607a082cd5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 10 Nov 2002 16:01:04 +0000 Subject: Add $(POPT_LIB_OBJ) to PROTO_OBJ (This used to be commit ba34be7033bced52eabf4e0b367a32a5196ef127) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 94920a6e75e..b6c5c367645 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -467,7 +467,7 @@ PROTO_OBJ = $(SMBD_OBJ_MAIN) \ $(PRINTING_OBJ) $(PRINTBACKEND_OBJ) $(OPLOCK_OBJ) $(NOTIFY_OBJ) \ $(QUOTAOBJS) $(PASSDB_OBJ) $(GROUPDB_OBJ) $(MSDFS_OBJ) \ $(READLINE_OBJ) $(PROFILE_OBJ) $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) \ - $(LIB_SMBD_OBJ) $(SAM_OBJ) $(REGISTRY_OBJ) + $(LIB_SMBD_OBJ) $(SAM_OBJ) $(REGISTRY_OBJ) $(POPT_LIB_OBJ) NSS_OBJ_0 = nsswitch/wins.o $(PARAM_OBJ) $(UBIQX_OBJ) $(LIBSMB_OBJ) \ $(LIB_OBJ) $(NSSWINS_OBJ) -- cgit From 9d7cd6643150704fab06982603b87df22bb3528e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 10 Nov 2002 16:29:50 +0000 Subject: Print the number of returned rows, not the number of fields (This used to be commit f4110a0f80a4f62d548b6d6cae81692476ef85ba) --- source3/passdb/pdb_mysql.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/passdb/pdb_mysql.c b/source3/passdb/pdb_mysql.c index 0df630d1ee1..66429cb4d83 100644 --- a/source3/passdb/pdb_mysql.c +++ b/source3/passdb/pdb_mysql.c @@ -370,8 +370,8 @@ static NTSTATUS mysqlsam_setsampwent(struct pdb_methods *methods, BOOL update) } DEBUG(5, - ("mysqlsam_setsampwent succeeded(%d results)!\n", - mysql_num_fields(data->pwent))); + ("mysqlsam_setsampwent succeeded(%lu results)!\n", + mysql_num_rows(data->pwent))); return NT_STATUS_OK; } -- cgit From 7f94064e4ae14b1bfdbb6553420c504a1e571103 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 10 Nov 2002 22:24:10 +0000 Subject: First cut of fix for changenotify on a print server handle. Use the connections tdb with an snum of -1 and a special printername. Jeremy. (This used to be commit 940b04ddfa87acc939911e3fe76496e3c4675632) --- source3/printing/printing.c | 123 +++++++++++++++++++++++------------- source3/rpc_server/srv_spoolss_nt.c | 40 ++++++++---- 2 files changed, 109 insertions(+), 54 deletions(-) diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 9bc4606adaa..cc4d588e2dd 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1046,15 +1046,16 @@ static void print_queue_update(int snum) ****************************************************************************/ #define NOTIFY_PID_LIST_KEY "NOTIFY_PID_LIST" +#define PRINT_SERVER_ENTRY_NAME "___PRINT_SERVER_ENTRY___" -static TDB_DATA get_printer_notify_pid_list(struct tdb_print_db *pdb, BOOL cleanlist) +static TDB_DATA get_printer_notify_pid_list(TDB_CONTEXT *tdb, const char *printer_name, BOOL cleanlist) { TDB_DATA data; size_t i; ZERO_STRUCT(data); - data = tdb_fetch_by_string( pdb->tdb, NOTIFY_PID_LIST_KEY ); + data = tdb_fetch_by_string( tdb, NOTIFY_PID_LIST_KEY ); if (!data.dptr) { ZERO_STRUCT(data); @@ -1062,9 +1063,8 @@ static TDB_DATA get_printer_notify_pid_list(struct tdb_print_db *pdb, BOOL clean } if (data.dsize % 8) { - DEBUG(0,("get_printer_notify_pid_list: Size of record for printer %s not a multiple of 8 !\n", - pdb->printer_name )); - tdb_delete_by_string(pdb->tdb, NOTIFY_PID_LIST_KEY ); + DEBUG(0,("get_printer_notify_pid_list: Size of record for printer %s not a multiple of 8 !\n", printer_name )); + tdb_delete_by_string(tdb, NOTIFY_PID_LIST_KEY ); ZERO_STRUCT(data); return data; } @@ -1089,7 +1089,7 @@ static TDB_DATA get_printer_notify_pid_list(struct tdb_print_db *pdb, BOOL clean /* Refcount == zero is a logic error and should never happen. */ if (IVAL(data.dptr, i + 4) == 0) { DEBUG(0,("get_printer_notify_pid_list: Refcount == 0 for pid = %u printer %s !\n", - (unsigned int)pid, pdb->printer_name )); + (unsigned int)pid, printer_name )); } if (data.dsize - i > 8) @@ -1108,7 +1108,8 @@ static TDB_DATA get_printer_notify_pid_list(struct tdb_print_db *pdb, BOOL clean BOOL print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx, size_t *p_num_pids, pid_t **pp_pid_list) { - struct tdb_print_db *pdb; + struct tdb_print_db *pdb = NULL; + TDB_CONTEXT *tdb = NULL; TDB_DATA data; BOOL ret = True; size_t i, num_pids, offset; @@ -1117,17 +1118,25 @@ BOOL print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx, size_t *p_num_pids = 0; *pp_pid_list = NULL; - pdb = get_print_db_byname(printername); - if (!pdb) - return False; + if (strequal(printername, PRINT_SERVER_ENTRY_NAME)) { + pdb = NULL; + tdb = conn_tdb_ctx(); + } else { + pdb = get_print_db_byname(printername); + if (!pdb) + return False; + tdb = pdb->tdb; + } - if (tdb_read_lock_bystring(pdb->tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { - DEBUG(0,("print_notify_pid_list: Failed to lock printer %s database\n", printername)); - release_print_db(pdb); + if (tdb_read_lock_bystring(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { + DEBUG(0,("print_notify_pid_list: Failed to lock printer %s database\n", + printername)); + if (pdb) + release_print_db(pdb); return False; } - data = get_printer_notify_pid_list( pdb, True ); + data = get_printer_notify_pid_list( tdb, printername, True ); if (!data.dptr) { ret = True; @@ -1151,8 +1160,9 @@ BOOL print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx, size_t done: - tdb_read_unlock_bystring(pdb->tdb, NOTIFY_PID_LIST_KEY); - release_print_db(pdb); + tdb_read_unlock_bystring(tdb, NOTIFY_PID_LIST_KEY); + if (pdb) + release_print_db(pdb); SAFE_FREE(data.dptr); return ret; } @@ -1165,23 +1175,34 @@ BOOL print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx, size_t BOOL print_notify_register_pid(int snum) { TDB_DATA data; - struct tdb_print_db *pdb; - const char *printername = lp_const_servicename(snum); + struct tdb_print_db *pdb = NULL; + TDB_CONTEXT *tdb = NULL; + const char *printername; uint32 mypid = (uint32)sys_getpid(); BOOL ret = False; size_t i; - pdb = get_print_db_byname(printername); - if (!pdb) - return False; + if (snum != -1) { + printername = lp_const_servicename(snum); + pdb = get_print_db_byname(printername); + if (!pdb) + return False; + tdb = pdb->tdb; + } else { + printername = PRINT_SERVER_ENTRY_NAME; + pdb = NULL; + tdb = conn_tdb_ctx(); + } - if (tdb_lock_bystring(pdb->tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { - DEBUG(0,("print_notify_register_pid: Failed to lock printer %s\n", printername)); - release_print_db(pdb); + if (tdb_lock_bystring(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { + DEBUG(0,("print_notify_register_pid: Failed to lock printer %s\n", + printername)); + if (pdb) + release_print_db(pdb); return False; } - data = get_printer_notify_pid_list( pdb, True ); + data = get_printer_notify_pid_list( tdb, printername, True ); /* Add ourselves and increase the refcount. */ @@ -1197,7 +1218,8 @@ BOOL print_notify_register_pid(int snum) /* We weren't in the list. Realloc. */ data.dptr = Realloc(data.dptr, data.dsize + 8); if (!data.dptr) { - DEBUG(0,("print_notify_register_pid: Relloc fail for printer %s\n", printername)); + DEBUG(0,("print_notify_register_pid: Relloc fail for printer %s\n", + printername)); goto done; } data.dsize += 8; @@ -1206,8 +1228,9 @@ BOOL print_notify_register_pid(int snum) } /* Store back the record. */ - if (tdb_store_by_string(pdb->tdb, NOTIFY_PID_LIST_KEY, data, TDB_REPLACE) == -1) { - DEBUG(0,("print_notify_register_pid: Failed to update pid list for printer %s\n", printername)); + if (tdb_store_by_string(tdb, NOTIFY_PID_LIST_KEY, data, TDB_REPLACE) == -1) { + DEBUG(0,("print_notify_register_pid: Failed to update pid \ +list for printer %s\n", printername)); goto done; } @@ -1215,8 +1238,9 @@ BOOL print_notify_register_pid(int snum) done: - tdb_unlock_bystring(pdb->tdb, NOTIFY_PID_LIST_KEY); - release_print_db(pdb); + tdb_unlock_bystring(tdb, NOTIFY_PID_LIST_KEY); + if (pdb) + release_print_db(pdb); SAFE_FREE(data.dptr); return ret; } @@ -1229,23 +1253,34 @@ BOOL print_notify_register_pid(int snum) BOOL print_notify_deregister_pid(int snum) { TDB_DATA data; - struct tdb_print_db *pdb; - const char *printername = lp_const_servicename(snum); + struct tdb_print_db *pdb = NULL; + TDB_CONTEXT *tdb = NULL; + const char *printername; uint32 mypid = (uint32)sys_getpid(); size_t i; BOOL ret = False; - pdb = get_print_db_byname(printername); - if (!pdb) - return False; + if (snum != -1) { + printername = lp_const_servicename(snum); + pdb = get_print_db_byname(printername); + if (!pdb) + return False; + tdb = pdb->tdb; + } else { + printername = PRINT_SERVER_ENTRY_NAME; + pdb = NULL; + tdb = conn_tdb_ctx(); + } - if (tdb_lock_bystring(pdb->tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { - DEBUG(0,("print_notify_register_pid: Failed to lock printer %s database\n", printername)); - release_print_db(pdb); + if (tdb_lock_bystring(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { + DEBUG(0,("print_notify_register_pid: Failed to lock \ +printer %s database\n", printername)); + if (pdb) + release_print_db(pdb); return False; } - data = get_printer_notify_pid_list( pdb, True ); + data = get_printer_notify_pid_list( tdb, printername, True ); /* Reduce refcount. Remove ourselves if zero. */ @@ -1271,8 +1306,9 @@ BOOL print_notify_deregister_pid(int snum) SAFE_FREE(data.dptr); /* Store back the record. */ - if (tdb_store_by_string(pdb->tdb, NOTIFY_PID_LIST_KEY, data, TDB_REPLACE) == -1) { - DEBUG(0,("print_notify_register_pid: Failed to update pid list for printer %s\n", printername)); + if (tdb_store_by_string(tdb, NOTIFY_PID_LIST_KEY, data, TDB_REPLACE) == -1) { + DEBUG(0,("print_notify_register_pid: Failed to update pid \ +list for printer %s\n", printername)); goto done; } @@ -1280,8 +1316,9 @@ BOOL print_notify_deregister_pid(int snum) done: - tdb_unlock_bystring(pdb->tdb, NOTIFY_PID_LIST_KEY); - release_print_db(pdb); + tdb_unlock_bystring(tdb, NOTIFY_PID_LIST_KEY); + if (pdb) + release_print_db(pdb); SAFE_FREE(data.dptr); return ret; } diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index f8262110ce1..2227d39f44c 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -226,9 +226,19 @@ static void free_printer_entry(void *ptr) { Printer_entry *Printer = (Printer_entry *)ptr; - if (Printer->notify.client_connected==True) - srv_spoolss_replycloseprinter(print_queue_snum(Printer->dev.handlename), - &Printer->notify.client_hnd); + if (Printer->notify.client_connected==True) { + int snum = -1; + + if ( Printer->printer_type == PRINTER_HANDLE_IS_PRINTSERVER) { + snum = -1; + srv_spoolss_replycloseprinter(snum, &Printer->notify.client_hnd); + } else if (Printer->printer_type == PRINTER_HANDLE_IS_PRINTER) { + snum = print_queue_snum(Printer->dev.handlename); + if (snum != -1) + srv_spoolss_replycloseprinter(snum, + &Printer->notify.client_hnd); + } + } Printer->notify.flags=0; Printer->notify.options=0; @@ -2471,7 +2481,7 @@ WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE uint32 options = q_u->options; UNISTR2 *localmachine = &q_u->localmachine; uint32 printerlocal = q_u->printerlocal; - int snum; + int snum = -1; SPOOL_NOTIFY_OPTION *option = q_u->option; /* store the notify value in the printer struct */ @@ -2483,9 +2493,6 @@ WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE return WERR_BADFID; } - if ( (Printer->printer_type == PRINTER_HANDLE_IS_PRINTER) && !get_printer_snum(p, handle, &snum) ) - return WERR_BADFID; - Printer->notify.flags=flags; Printer->notify.options=options; Printer->notify.printerlocal=printerlocal; @@ -2500,6 +2507,12 @@ WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE /* Connect to the client machine and send a ReplyOpenPrinter */ + if ( Printer->printer_type == PRINTER_HANDLE_IS_PRINTSERVER) + snum = -1; + else if ( (Printer->printer_type == PRINTER_HANDLE_IS_PRINTER) && + !get_printer_snum(p, handle, &snum) ) + return WERR_BADFID; + if(!srv_spoolss_replyopenprinter(snum, Printer->notify.localmachine, Printer->notify.printerlocal, 1, &Printer->notify.client_hnd)) @@ -5859,7 +5872,6 @@ WERROR _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SET WERROR _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u) { POLICY_HND *handle = &q_u->handle; - int snum; Printer_entry *Printer= find_printer_index_by_hnd(p, handle); if (!Printer) { @@ -5867,11 +5879,17 @@ WERROR _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u) return WERR_BADFID; } - if (!get_printer_snum(p, handle, &snum)) - return WERR_BADFID; + if (Printer->notify.client_connected==True) { + int snum = -1; + + if ( Printer->printer_type == PRINTER_HANDLE_IS_PRINTSERVER) + snum = -1; + else if ( (Printer->printer_type == PRINTER_HANDLE_IS_PRINTER) && + !get_printer_snum(p, handle, &snum) ) + return WERR_BADFID; - if (Printer->notify.client_connected==True) srv_spoolss_replycloseprinter(snum, &Printer->notify.client_hnd); + } Printer->notify.flags=0; Printer->notify.options=0; -- cgit From 4d8d3ce32150eed4005b158c03c21933c52c2181 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 11 Nov 2002 09:01:24 +0000 Subject: union is better to avoid problems with pointers (This used to be commit 1645567db3e85151c139115fdc1238149ccf33a2) --- source3/include/gums.h | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/source3/include/gums.h b/source3/include/gums.h index d1799f377d9..a44dadc8837 100644 --- a/source3/include/gums.h +++ b/source3/include/gums.h @@ -24,32 +24,14 @@ #define GUMS_VERSION_MAJOR 0 #define GUMS_VERSION_MINOR 1 -#define GUMS_OBJ_NORMAL_USER 1 -#define GUMS_OBJ_GROUP 2 -#define GUMS_OBJ_DOMAIN 3 +#define GUMS_OBJ_DOMAIN 1 +#define GUMS_OBJ_NORMAL_USER 2 +#define GUMS_OBJ_GROUP 3 #define GUMS_OBJ_ALIAS 4 #define GUMS_OBJ_WORKSTATION_TRUST 5 #define GUMS_OBJ_SERVER_TRUST 6 #define GUMS_OBJ_DOMAIN_TRUST 7 -typedef struct gums_object -{ - TALLOC_CTX *mem_ctx; - - uint32 type; /* Object Type */ - uint32 version; /* Object Version */ - uint32 seq_num; /* Object Sequence Number */ - - SEC_DESC *sec_desc; /* Security Descriptor */ - - DOM_SID *sid; /* Object Sid */ - char *name; /* Object Name */ - char *description; /* Object Description */ - - void *data; /* Object Specific data */ - -} GUMS_OBJECT; - typedef struct gums_user { DOM_SID *group_sid; /* Primary Group SID */ @@ -91,6 +73,30 @@ typedef struct gums_group } GUMS_GROUP; +union gums_obj_p { + gums_user *user; + gums_group *group; + gums_group *alias; +} + +typedef struct gums_object +{ + TALLOC_CTX *mem_ctx; + + uint32 type; /* Object Type */ + uint32 version; /* Object Version */ + uint32 seq_num; /* Object Sequence Number */ + + SEC_DESC *sec_desc; /* Security Descriptor */ + + DOM_SID *sid; /* Object Sid */ + char *name; /* Object Name */ + char *description; /* Object Description */ + + union gums_obj_p data; /* Object Specific data */ + +} GUMS_OBJECT; + typedef struct gums_data_set { int type; /* GUMS_SET_xxx */ -- cgit From 72b9b48904fb006112256d532445355499a51700 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 11 Nov 2002 13:29:46 +0000 Subject: Add note about error that happens when the loopback device doesn't work (This used to be commit 377631b3a07c0fb52e4374cc2484e7852d81a84e) --- docs/docbook/faq/errors.sgml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/docbook/faq/errors.sgml b/docs/docbook/faq/errors.sgml index 2f378a3688b..819462899e7 100644 --- a/docs/docbook/faq/errors.sgml +++ b/docs/docbook/faq/errors.sgml @@ -167,4 +167,10 @@ A domain controller has to announce on the network who it is. This usually takes + +I'm getting "open_oplock_ipc: Failed to get local UDP socket for address 100007f. Error was Cannot assign requested" in the logs +Your loopback device isn't working correctly. Make sure it's running. + + + -- cgit From bd4ed6eea04882f7066e991434ec90dd97b68b1b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 11 Nov 2002 13:49:25 +0000 Subject: Fix typo (This used to be commit 9b469a2aca6de79a5940769b56d15d22e471b2b5) --- examples/pdb/mysql/mysql.dump | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pdb/mysql/mysql.dump b/examples/pdb/mysql/mysql.dump index 12eac6cdc7e..3bd6d198007 100644 --- a/examples/pdb/mysql/mysql.dump +++ b/examples/pdb/mysql/mysql.dump @@ -1,7 +1,7 @@ # Put this in your MySQL database by running # mysql -u -p -h < mysql.dump -CREATE TABEL user ( +CREATE TABLE user ( logon_time int(9), logoff_time int(9), kickoff_time int(9), -- cgit From 3eb60559d859b71ce71756af956203f53a6e8670 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Mon, 11 Nov 2002 15:41:04 +0000 Subject: Add getdata and getdataex commands (This used to be commit 101727335fffd4011659bfa9f7f8ab24b641fc4e) --- source3/rpcclient/cmd_spoolss.c | 225 +++++++++++++++++++++++++++++++++------- 1 file changed, 187 insertions(+), 38 deletions(-) diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 83096a36323..c76e84580d6 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -69,7 +69,7 @@ BOOL get_short_archi(char *short_archi, char *long_archi) return True; } - +#if 0 /********************************************************************** * dummy function -- placeholder */ @@ -80,6 +80,7 @@ static NTSTATUS cmd_spoolss_not_implemented(struct cli_state *cli, printf ("(*) This command is not currently implemented.\n"); return NT_STATUS_OK; } +#endif /*********************************************************************** * Get printer information @@ -611,6 +612,189 @@ static NTSTATUS cmd_spoolss_getprinter(struct cli_state *cli, return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; } +static void display_reg_value(REGISTRY_VALUE value) +{ + pstring text; + + switch(value.type) { + case REG_DWORD: + printf("%s: REG_DWORD: 0x%08x\n", value.valuename, + *((uint32 *) value.data_p)); + break; + case REG_SZ: + rpcstr_pull(text, value.data_p, sizeof(text), value.size, + STR_TERMINATE); + printf("%s: REG_SZ: %s\n", value.valuename, text); + break; + case REG_BINARY: + printf("%s: REG_BINARY: unknown length value not displayed\n", + value.valuename); + break; + case REG_MULTI_SZ: { + uint16 *curstr = (uint16 *) value.data_p; + uint8 *start = value.data_p; + printf("%s: REG_MULTI_SZ:\n", value.valuename); + while ((*curstr != 0) && + ((uint8 *) curstr < start + value.size)) { + rpcstr_pull(text, curstr, sizeof(text), -1, + STR_TERMINATE); + printf(" %s\n", text); + curstr += strlen(text) + 1; + } + } + break; + default: + printf("%s: unknown type %d\n", value.valuename, value.type); + } + +} + +/*********************************************************************** + * Get printer data + */ +static NTSTATUS cmd_spoolss_getprinterdata(struct cli_state *cli, + TALLOC_CTX *mem_ctx, + int argc, char **argv) +{ + POLICY_HND pol; + WERROR result; + BOOL opened_hnd = False; + fstring printername, + servername, + user; + uint32 needed; + char *valuename; + REGISTRY_VALUE value; + + if (argc != 3) { + printf("Usage: %s \n", argv[0]); + printf(" of . queries print server\n"); + return NT_STATUS_OK; + } + valuename = argv[2]; + + /* Open a printer handle */ + + slprintf (servername, sizeof(fstring)-1, "\\\\%s", cli->desthost); + strupper (servername); + if (strncmp(argv[1], ".", sizeof(".")) == 0) + fstrcpy(printername, servername); + else + slprintf (printername, sizeof(fstring)-1, "%s\\%s", + servername, argv[1]); + fstrcpy (user, cli->user_name); + + /* get a printer handle */ + + result = cli_spoolss_open_printer_ex(cli, mem_ctx, printername, + "", MAXIMUM_ALLOWED_ACCESS, + servername, user, &pol); + + if (!W_ERROR_IS_OK(result)) + goto done; + + opened_hnd = True; + + /* Get printer info */ + + result = cli_spoolss_getprinterdata(cli, mem_ctx, 0, &needed, + &pol, valuename, &value); + + if (W_ERROR_V(result) == ERRmoredata) + result = cli_spoolss_getprinterdata( + cli, mem_ctx, needed, NULL, &pol, valuename, &value); + + if (!W_ERROR_IS_OK(result)) + goto done; + + /* Display printer data */ + + fstrcpy(value.valuename, valuename); + display_reg_value(value); + + + done: + if (opened_hnd) + cli_spoolss_close_printer(cli, mem_ctx, &pol); + + return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; +} + +/*********************************************************************** + * Get printer data + */ +static NTSTATUS cmd_spoolss_getprinterdataex(struct cli_state *cli, + TALLOC_CTX *mem_ctx, + int argc, char **argv) +{ + POLICY_HND pol; + WERROR result; + BOOL opened_hnd = False; + fstring printername, + servername, + user; + uint32 needed; + char *valuename, *keyname; + REGISTRY_VALUE value; + + if (argc != 4) { + printf("Usage: %s \n", + argv[0]); + printf(" of . queries print server\n"); + return NT_STATUS_OK; + } + valuename = argv[3]; + keyname = argv[2]; + + /* Open a printer handle */ + + slprintf (servername, sizeof(fstring)-1, "\\\\%s", cli->desthost); + strupper (servername); + if (strncmp(argv[1], ".", sizeof(".")) == 0) + fstrcpy(printername, servername); + else + slprintf (printername, sizeof(fstring)-1, "%s\\%s", + servername, argv[1]); + fstrcpy (user, cli->user_name); + + /* get a printer handle */ + + result = cli_spoolss_open_printer_ex(cli, mem_ctx, printername, + "", MAXIMUM_ALLOWED_ACCESS, + servername, user, &pol); + + if (!W_ERROR_IS_OK(result)) + goto done; + + opened_hnd = True; + + /* Get printer info */ + + result = cli_spoolss_getprinterdataex(cli, mem_ctx, 0, &needed, + &pol, keyname, valuename, + &value); + + if (W_ERROR_V(result) == ERRmoredata) + result = cli_spoolss_getprinterdataex(cli, mem_ctx, needed, + NULL, &pol, keyname, + valuename, &value); + + if (!W_ERROR_IS_OK(result)) + goto done; + + /* Display printer data */ + + fstrcpy(value.valuename, valuename); + display_reg_value(value); + + + done: + if (opened_hnd) + cli_spoolss_close_printer(cli, mem_ctx, &pol); + + return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; +} + /**************************************************************************** printer info level 0 display function ****************************************************************************/ @@ -1814,42 +1998,6 @@ done: return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; } -static void display_reg_value(REGISTRY_VALUE value) -{ - pstring text; - - switch(value.type) { - case REG_DWORD: - printf("%s: REG_DWORD: 0x%08x\n", value.valuename, - *((uint32 *) value.data_p)); - break; - case REG_SZ: - rpcstr_pull(text, value.data_p, sizeof(text), value.size, - STR_TERMINATE); - printf("%s: REG_SZ: %s\n", value.valuename, text); - break; - case REG_BINARY: - printf("%s: REG_BINARY: unknown length value not displayed\n", - value.valuename); - break; - case REG_MULTI_SZ: { - uint16 *curstr = (uint16 *) value.data_p; - uint8 *start = value.data_p; - printf("%s: REG_MULTI_SZ:\n", value.valuename); - while ((*curstr != 0) && - ((uint8 *) curstr < start + value.size)) { - rpcstr_pull(text, curstr, sizeof(text), -1, - STR_TERMINATE); - printf(" %s\n", text); - curstr += strlen(text) + 1; - } - } - break; - default: - printf("%s: unknown type %d\n", value.valuename, value.type); - } - -} /* enumerate data */ static NTSTATUS cmd_spoolss_enum_data( struct cli_state *cli, @@ -2145,7 +2293,8 @@ struct cmd_set spoolss_commands[] = { { "enumports", cmd_spoolss_enum_ports, PI_SPOOLSS, "Enumerate printer ports", "" }, { "enumdrivers", cmd_spoolss_enum_drivers, PI_SPOOLSS, "Enumerate installed printer drivers", "" }, { "enumprinters", cmd_spoolss_enum_printers, PI_SPOOLSS, "Enumerate printers", "" }, - { "getdata", cmd_spoolss_not_implemented, PI_SPOOLSS, "Get print driver data (*)", "" }, + { "getdata", cmd_spoolss_getprinterdata, PI_SPOOLSS, "Get print driver data", "" }, + { "getdataex", cmd_spoolss_getprinterdataex, PI_SPOOLSS, "Get printer driver data with keyname", ""}, { "getdriver", cmd_spoolss_getdriver, PI_SPOOLSS, "Get print driver information", "" }, { "getdriverdir", cmd_spoolss_getdriverdir, PI_SPOOLSS, "Get print driver upload directory", "" }, { "getprinter", cmd_spoolss_getprinter, PI_SPOOLSS, "Get printer info", "" }, -- cgit From 624a4fc009ce89a5cce77996606c30fbc6ec35fe Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 11 Nov 2002 18:41:28 +0000 Subject: Add extra debug info (This used to be commit 79207d56929de2acc15a761b23c8b33369c298ee) --- source3/passdb/pdb_mysql.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/passdb/pdb_mysql.c b/source3/passdb/pdb_mysql.c index 66429cb4d83..b1b66466380 100644 --- a/source3/passdb/pdb_mysql.c +++ b/source3/passdb/pdb_mysql.c @@ -357,7 +357,7 @@ static NTSTATUS mysqlsam_setsampwent(struct pdb_methods *methods, BOOL update) if (ret) { DEBUG(0, - ("Error executing query: %s\n", mysql_error(data->handle))); + ("Error executing MySQL query %s: %s\n", query, mysql_error(data->handle))); return NT_STATUS_UNSUCCESSFUL; } @@ -525,7 +525,7 @@ static NTSTATUS mysqlsam_select_by_field(struct pdb_methods * methods, SAM_ACCOU if (mysql_ret) { DEBUG(0, - ("Error while executing MySQL query: %s\n", + ("Error while executing MySQL query %s: %s\n", query, mysql_error(data->handle))); return NT_STATUS_UNSUCCESSFUL; } -- cgit From 52b0efec1aa1ec0d6ea40c2874b57082af8d39ca Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 11 Nov 2002 18:53:23 +0000 Subject: More improvement of DEBUG output (This used to be commit 21530f06b2b89d159657646fe15e16a3fcfdb668) --- source3/passdb/pdb_mysql.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source3/passdb/pdb_mysql.c b/source3/passdb/pdb_mysql.c index b1b66466380..319bad7da2e 100644 --- a/source3/passdb/pdb_mysql.c +++ b/source3/passdb/pdb_mysql.c @@ -351,13 +351,14 @@ static NTSTATUS mysqlsam_setsampwent(struct pdb_methods *methods, BOOL update) CONFIG_UNKNOWN_6_DEFAULT), config_value(data, "table", CONFIG_TABLE_DEFAULT) ); + DEBUG(5, ("Executing query %s\n", query)); ret = mysql_query(data->handle, query); SAFE_FREE(query); if (ret) { DEBUG(0, - ("Error executing MySQL query %s: %s\n", query, mysql_error(data->handle))); + ("Error executing MySQL query %s\n", mysql_error(data->handle))); return NT_STATUS_UNSUCCESSFUL; } @@ -518,6 +519,8 @@ static NTSTATUS mysqlsam_select_by_field(struct pdb_methods * methods, SAM_ACCOU esc_sname); SAFE_FREE(esc_sname); + + DEBUG(5, ("Executing query %s\n", query)); mysql_ret = mysql_query(data->handle, query); @@ -525,7 +528,7 @@ static NTSTATUS mysqlsam_select_by_field(struct pdb_methods * methods, SAM_ACCOU if (mysql_ret) { DEBUG(0, - ("Error while executing MySQL query %s: %s\n", query, + ("Error while executing MySQL query %s\n", mysql_error(data->handle))); return NT_STATUS_UNSUCCESSFUL; } -- cgit From 6ff60f301e48692087dd9ebd15ad784924868bb3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 11 Nov 2002 19:20:23 +0000 Subject: fix typo(s/plaintext pass column/plain pass column/) (This used to be commit 411647ecfbfbb17e46ea2289a09e77a2fbb1162f) --- docs/docbook/projdoc/pdb_mysql.sgml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docbook/projdoc/pdb_mysql.sgml b/docs/docbook/projdoc/pdb_mysql.sgml index 220f17caa19..05262ebe103 100644 --- a/docs/docbook/projdoc/pdb_mysql.sgml +++ b/docs/docbook/projdoc/pdb_mysql.sgml @@ -81,7 +81,7 @@ identifier:user sid column - varchar(255) - NT user SID identifier:group sid column - varchar(255) - NT group ID identifier:lanman pass column - varchar(255) - encrypted lanman password identifier:nt pass column - varchar(255) - encrypted nt passwd -identifier:plaintext pass column - varchar(255) - plaintext password +identifier:plain pass column - varchar(255) - plaintext password identifier:acct control column - int(9) - nt user data identifier:unknown 3 column - int(9) - unknown identifier:logon divs column - int(9) - ? @@ -107,11 +107,11 @@ I strongly discourage the use of plaintext passwords, however, you can use them: -If you would like to use plaintext passwords, set 'identifier:lanman pass column' and 'identifier:nt pass column' to 'NULL' (without the quotes) and 'identifier:plaintext pass column' to the name of the column containing the plaintext passwords. +If you would like to use plaintext passwords, set 'identifier:lanman pass column' and 'identifier:nt pass column' to 'NULL' (without the quotes) and 'identifier:plain pass column' to the name of the column containing the plaintext passwords. -If you use encrypted passwords, set the 'identifier:plaintext pass column' to 'NULL' (without the quotes). This is the default. +If you use encrypted passwords, set the 'identifier:plain pass column' to 'NULL' (without the quotes). This is the default. -- cgit From b0f9f11f5fd3aa10be3f7dd3b5d1702222db014f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 11 Nov 2002 22:05:05 +0000 Subject: fix for CR 601. Only call addprinter command when the port, driver, comment, or location field changed (This used to be commit c6d45216f6d3573fb2342f4d3aa3a50415924674) --- source3/rpc_server/srv_spoolss_nt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 2227d39f44c..871aac8e68e 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -5780,8 +5780,14 @@ static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level, } /* Call addprinter hook */ - - if (*lp_addprinter_cmd()) { + /* Check changes to see if this is really needed */ + + if ( *lp_addprinter_cmd() + && (!strequal(printer->info_2->drivername, old_printer->info_2->drivername) + || !strequal(printer->info_2->comment, old_printer->info_2->comment) + || !strequal(printer->info_2->portname, old_printer->info_2->portname) + || !strequal(printer->info_2->location, old_printer->info_2->location)) ) + { if ( !add_printer_hook(printer) ) { result = WERR_ACCESS_DENIED; goto done; -- cgit From 0e8dc732ae9eea38329615aabd949024d84158f4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 11 Nov 2002 22:12:48 +0000 Subject: Fix all returns to be size_t (they are all unsigned). Fixup strlen being done on ucs2 strings. Jeremy. (This used to be commit 205e8f03015dd533ae62753f2098505f1231e3e4) --- source3/lib/charcnv.c | 457 +++++++++++++++++++++++++++----------------------- 1 file changed, 244 insertions(+), 213 deletions(-) diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index d0cef52c923..04145fd17ab 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -27,8 +27,9 @@ static pstring cvtbuf; static smb_iconv_t conv_handles[NUM_CHARSETS][NUM_CHARSETS]; /**************************************************************************** -return the name of a charset to give to iconv() + Return the name of a charset to give to iconv(). ****************************************************************************/ + static char *charset_name(charset_t ch) { char *ret = NULL; @@ -43,7 +44,6 @@ static char *charset_name(charset_t ch) return ret; } - static void lazy_initialize_conv(void) { static int initialized = False; @@ -57,8 +57,9 @@ static void lazy_initialize_conv(void) } /**************************************************************************** - Initialize iconv conversion descriptors + Initialize iconv conversion descriptors. ****************************************************************************/ + void init_iconv(void) { int c1, c2; @@ -66,13 +67,11 @@ void init_iconv(void) /* so that charset_name() works we need to get the UNIX<->UCS2 going first */ - if (!conv_handles[CH_UNIX][CH_UCS2]) { + if (!conv_handles[CH_UNIX][CH_UCS2]) conv_handles[CH_UNIX][CH_UCS2] = smb_iconv_open("UCS-2LE", "ASCII"); - } - if (!conv_handles[CH_UCS2][CH_UNIX]) { + + if (!conv_handles[CH_UCS2][CH_UNIX]) conv_handles[CH_UCS2][CH_UNIX] = smb_iconv_open("ASCII", "UCS-2LE"); - } - for (c1=0;c1from_name) == 0 && - strcmp(n2, conv_handles[c1][c2]->to_name) == 0) continue; + strcmp(n2, conv_handles[c1][c2]->to_name) == 0) + continue; did_reload = True; - if (conv_handles[c1][c2]) { + if (conv_handles[c1][c2]) smb_iconv_close(conv_handles[c1][c2]); - } + conv_handles[c1][c2] = smb_iconv_open(n2,n1); if (conv_handles[c1][c2] == (smb_iconv_t)-1) { DEBUG(0,("Conversion from %s to %s not supported\n", @@ -111,6 +111,7 @@ void init_iconv(void) * @param destlen maximal length allowed for string * @retval the number of bytes occupied in the destination **/ + size_t convert_string(charset_t from, charset_t to, void const *src, size_t srclen, void *dest, size_t destlen) @@ -121,7 +122,8 @@ size_t convert_string(charset_t from, charset_t to, char* outbuf = (char*)dest; smb_iconv_t descriptor; - if (srclen == -1) srclen = strlen(src)+1; + if (srclen == (size_t)-1) + srclen = strlen(src)+1; lazy_initialize_conv(); @@ -129,7 +131,7 @@ size_t convert_string(charset_t from, charset_t to, if (descriptor == (smb_iconv_t)-1 || descriptor == (smb_iconv_t)0) { /* conversion not supported, use as is */ - int len = MIN(srclen,destlen); + size_t len = MIN(srclen,destlen); memcpy(dest,src,len); return len; } @@ -137,22 +139,24 @@ size_t convert_string(charset_t from, charset_t to, i_len=srclen; o_len=destlen; retval = smb_iconv(descriptor, &inbuf, &i_len, &outbuf, &o_len); - if(retval==-1) - { + if(retval==-1) { char *reason="unknown error"; - switch(errno) - { case EINVAL: reason="Incomplete multibyte sequence"; break; - case E2BIG: reason="No more room"; - DEBUG(0, ("convert_string: Required %d, available %d\n", - srclen, destlen)); - /* we are not sure we need srclen bytes, + switch(errno) { + case EINVAL: + reason="Incomplete multibyte sequence"; + break; + case E2BIG: + reason="No more room"; + DEBUG(0, ("convert_string: Required %d, available %d\n", + srclen, destlen)); + /* we are not sure we need srclen bytes, may be more, may be less. We only know we need more than destlen bytes ---simo */ - - break; - case EILSEQ: reason="Illegal multibyte sequence"; break; + case EILSEQ: + reason="Illegal multibyte sequence"; + break; } /* smb_panic(reason); */ } @@ -168,6 +172,7 @@ size_t convert_string(charset_t from, charset_t to, * * @retval Size in bytes of the converted string; or -1 in case of error. **/ + size_t convert_string_allocate(charset_t from, charset_t to, void const *src, size_t srclen, void **dest) { @@ -179,7 +184,8 @@ size_t convert_string_allocate(charset_t from, charset_t to, *dest = NULL; - if (src == NULL || srclen == -1) return -1; + if (src == NULL || srclen == (size_t)-1) + return (size_t)-1; lazy_initialize_conv(); @@ -199,31 +205,30 @@ convert: if (!ob) { DEBUG(0, ("convert_string_allocate: realloc failed!\n")); SAFE_FREE(outbuf); - return -1; + return (size_t)-1; } - else outbuf = ob; + else + outbuf = ob; i_len = srclen; o_len = destlen; retval = smb_iconv(descriptor, &inbuf, &i_len, &outbuf, &o_len); - if(retval == -1) - { + if(retval == -1) { char *reason="unknown error"; - switch(errno) - { - case EINVAL: - reason="Incomplete multibyte sequence"; - break; - case E2BIG: - goto convert; - case EILSEQ: - reason="Illegal multibyte sequence"; - break; + switch(errno) { + case EINVAL: + reason="Incomplete multibyte sequence"; + break; + case E2BIG: + goto convert; + case EILSEQ: + reason="Illegal multibyte sequence"; + break; } DEBUG(0,("Conversion error: %s(%s)\n",reason,inbuf)); /* smb_panic(reason); */ - return -1; + return (size_t)-1; } destlen = destlen - o_len; @@ -231,7 +236,7 @@ convert: if (!*dest) { DEBUG(0, ("convert_string_allocate: out of memory!\n")); SAFE_FREE(ob); - return -1; + return (size_t)-1; } return destlen; @@ -246,6 +251,7 @@ convert: * * @retval Size in bytes of the converted string; or -1 in case of error. **/ + size_t convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, void const *src, size_t srclen, void **dest) { @@ -254,37 +260,40 @@ size_t convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, *dest = NULL; dest_len=convert_string_allocate(from, to, src, srclen, &alloced_string); - if (dest_len == -1) - return -1; + if (dest_len == (size_t)-1) + return (size_t)-1; *dest = talloc_memdup(ctx, alloced_string, dest_len); SAFE_FREE(alloced_string); if (*dest == NULL) - return -1; + return (size_t)-1; return dest_len; } -int unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen) +size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen) { - int size; + size_t size; smb_ucs2_t *buffer=(smb_ucs2_t*)cvtbuf; size=convert_string(CH_UNIX, CH_UCS2, src, srclen, buffer, sizeof(cvtbuf)); - if (!strupper_w(buffer) && (dest == src)) return srclen; + if (!strupper_w(buffer) && (dest == src)) + return srclen; return convert_string(CH_UCS2, CH_UNIX, buffer, size, dest, destlen); } -int unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen) +size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen) { - int size; + size_t size; smb_ucs2_t *buffer=(smb_ucs2_t*)cvtbuf; size=convert_string(CH_UNIX, CH_UCS2, src, srclen, buffer, sizeof(cvtbuf)); - if (!strlower_w(buffer) && (dest == src)) return srclen; + if (!strlower_w(buffer) && (dest == src)) + return srclen; return convert_string(CH_UCS2, CH_UNIX, buffer, size, dest, destlen); } -int ucs2_align(const void *base_ptr, const void *p, int flags) +size_t ucs2_align(const void *base_ptr, const void *p, int flags) { - if (flags & (STR_NOALIGN|STR_ASCII)) return 0; + if (flags & (STR_NOALIGN|STR_ASCII)) + return 0; return PTR_DIFF(p, base_ptr) & 1; } @@ -295,18 +304,18 @@ return the number of bytes occupied by the string in the destination flags can have: STR_TERMINATE means include the null termination STR_UPPER means uppercase in the destination -dest_len is the maximum length allowed in the destination. If dest_len +dest_len is the maximum length in bytes allowed in the destination. If dest_len is -1 then no maxiumum is used ****************************************************************************/ -int push_ascii(void *dest, const char *src, int dest_len, int flags) + +size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags) { - int src_len = strlen(src); + size_t src_len = strlen(src); pstring tmpbuf; /* treat a pstring as "unlimited" length */ - if (dest_len == -1) { + if (dest_len == (size_t)-1) dest_len = sizeof(pstring); - } if (flags & STR_UPPER) { pstrcpy(tmpbuf, src); @@ -314,93 +323,93 @@ int push_ascii(void *dest, const char *src, int dest_len, int flags) src = tmpbuf; } - if (flags & STR_TERMINATE) { + if (flags & STR_TERMINATE) src_len++; - } return convert_string(CH_UNIX, CH_DOS, src, src_len, dest, dest_len); } -int push_ascii_fstring(void *dest, const char *src) +size_t push_ascii_fstring(void *dest, const char *src) { return push_ascii(dest, src, sizeof(fstring), STR_TERMINATE); } -int push_ascii_pstring(void *dest, const char *src) +size_t push_ascii_pstring(void *dest, const char *src) { return push_ascii(dest, src, sizeof(pstring), STR_TERMINATE); } -int push_pstring(void *dest, const char *src) +size_t push_pstring(void *dest, const char *src) { return push_ascii(dest, src, sizeof(pstring), STR_TERMINATE); } - /**************************************************************************** -copy a string from a dos codepage source to a unix char* destination -flags can have: - STR_TERMINATE means the string in src is null terminated -if STR_TERMINATE is set then src_len is ignored -src_len is the length of the source area in bytes -return the number of bytes occupied by the string in src -the resulting string in "dest" is always null terminated + Copy a string from a dos codepage source to a unix char* destination. + Flags can have: + STR_TERMINATE means the string in src is null terminated. + if STR_TERMINATE is set then src_len is ignored. + src_len is the length of the source area in bytes. + Return the number of bytes occupied by the string in src. + The resulting string in "dest" is always null terminated. ****************************************************************************/ -int pull_ascii(char *dest, const void *src, int dest_len, int src_len, int flags) + +size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags) { - int ret; + size_t ret; - if (dest_len == -1) { + if (dest_len == (size_t)-1) dest_len = sizeof(pstring); - } if (flags & STR_TERMINATE) { - if (src_len == -1) { + if (src_len == (size_t)-1) { src_len = strlen(src) + 1; } else { - int len = strnlen(src, src_len); - if (len < src_len) len++; + size_t len = strnlen(src, src_len); + if (len < src_len) + len++; src_len = len; } } ret = convert_string(CH_DOS, CH_UNIX, src, src_len, dest, dest_len); - if (dest_len) dest[MIN(ret, dest_len-1)] = 0; + if (dest_len) + dest[MIN(ret, dest_len-1)] = 0; return src_len; } -int pull_ascii_pstring(char *dest, const void *src) +size_t pull_ascii_pstring(char *dest, const void *src) { return pull_ascii(dest, src, sizeof(pstring), -1, STR_TERMINATE); } -int pull_ascii_fstring(char *dest, const void *src) +size_t pull_ascii_fstring(char *dest, const void *src) { return pull_ascii(dest, src, sizeof(fstring), -1, STR_TERMINATE); } /**************************************************************************** -copy a string from a char* src to a unicode destination -return the number of bytes occupied by the string in the destination -flags can have: - STR_TERMINATE means include the null termination - STR_UPPER means uppercase in the destination - STR_NOALIGN means don't do alignment -dest_len is the maximum length allowed in the destination. If dest_len -is -1 then no maxiumum is used + Copy a string from a char* src to a unicode destination. + Return the number of bytes occupied by the string in the destination. + Flags can have: + STR_TERMINATE means include the null termination. + STR_UPPER means uppercase in the destination. + STR_NOALIGN means don't do alignment. + dest_len is the maximum length allowed in the destination. If dest_len + is -1 then no maxiumum is used. ****************************************************************************/ -int push_ucs2(const void *base_ptr, void *dest, const char *src, int dest_len, int flags) + +size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags) { - int len=0; - int src_len = strlen(src); + size_t len=0; + size_t src_len = strlen(src); pstring tmpbuf; /* treat a pstring as "unlimited" length */ - if (dest_len == -1) { + if (dest_len == (size_t)-1) dest_len = sizeof(pstring); - } if (flags & STR_UPPER) { pstrcpy(tmpbuf, src); @@ -408,9 +417,8 @@ int push_ucs2(const void *base_ptr, void *dest, const char *src, int dest_len, i src = tmpbuf; } - if (flags & STR_TERMINATE) { + if (flags & STR_TERMINATE) src_len++; - } if (ucs2_align(base_ptr, dest, flags)) { *(char *)dest = 0; @@ -434,9 +442,10 @@ int push_ucs2(const void *base_ptr, void *dest, const char *src, int dest_len, i * @retval The number of bytes occupied by the string in the destination * or -1 in case of error. **/ -int push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src) + +size_t push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src) { - int src_len = strlen(src)+1; + size_t src_len = strlen(src)+1; *dest = NULL; return convert_string_talloc(ctx, CH_UNIX, CH_UCS2, src, src_len, (void **)dest); @@ -450,32 +459,33 @@ int push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src) * @retval The number of bytes occupied by the string in the destination * or -1 in case of error. **/ -int push_ucs2_allocate(smb_ucs2_t **dest, const char *src) + +size_t push_ucs2_allocate(smb_ucs2_t **dest, const char *src) { - int src_len = strlen(src)+1; + size_t src_len = strlen(src)+1; *dest = NULL; return convert_string_allocate(CH_UNIX, CH_UCS2, src, src_len, (void **)dest); } /**************************************************************************** -copy a string from a char* src to a UTF-8 destination -return the number of bytes occupied by the string in the destination -flags can have: + Copy a string from a char* src to a UTF-8 destination. + Return the number of bytes occupied by the string in the destination + Flags can have: STR_TERMINATE means include the null termination STR_UPPER means uppercase in the destination -dest_len is the maximum length allowed in the destination. If dest_len -is -1 then no maxiumum is used + dest_len is the maximum length allowed in the destination. If dest_len + is -1 then no maxiumum is used. ****************************************************************************/ -int push_utf8(void *dest, const char *src, int dest_len, int flags) + +size_t push_utf8(void *dest, const char *src, size_t dest_len, int flags) { - int src_len = strlen(src); + size_t src_len = strlen(src); pstring tmpbuf; /* treat a pstring as "unlimited" length */ - if (dest_len == -1) { + if (dest_len == (size_t)-1) dest_len = sizeof(pstring); - } if (flags & STR_UPPER) { pstrcpy(tmpbuf, src); @@ -483,19 +493,18 @@ int push_utf8(void *dest, const char *src, int dest_len, int flags) src = tmpbuf; } - if (flags & STR_TERMINATE) { + if (flags & STR_TERMINATE) src_len++; - } return convert_string(CH_UNIX, CH_UTF8, src, src_len, dest, dest_len); } -int push_utf8_fstring(void *dest, const char *src) +size_t push_utf8_fstring(void *dest, const char *src) { return push_utf8(dest, src, sizeof(fstring), STR_TERMINATE); } -int push_utf8_pstring(void *dest, const char *src) +size_t push_utf8_pstring(void *dest, const char *src) { return push_utf8(dest, src, sizeof(pstring), STR_TERMINATE); } @@ -507,9 +516,10 @@ int push_utf8_pstring(void *dest, const char *src) * * @retval The number of bytes occupied by the string in the destination **/ -int push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src) + +size_t push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src) { - int src_len = strlen(src)+1; + size_t src_len = strlen(src)+1; *dest = NULL; return convert_string_talloc(ctx, CH_UNIX, CH_UTF8, src, src_len, (void**)dest); @@ -522,63 +532,67 @@ int push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src) * * @retval The number of bytes occupied by the string in the destination **/ -int push_utf8_allocate(char **dest, const char *src) + +size_t push_utf8_allocate(char **dest, const char *src) { - int src_len = strlen(src)+1; + size_t src_len = strlen(src)+1; *dest = NULL; return convert_string_allocate(CH_UNIX, CH_UTF8, src, src_len, (void **)dest); } /**************************************************************************** -copy a string from a ucs2 source to a unix char* destination -flags can have: - STR_TERMINATE means the string in src is null terminated - STR_NOALIGN means don't try to align -if STR_TERMINATE is set then src_len is ignored if it is -1 -src_len is the length of the source area in bytes -return the number of bytes occupied by the string in src -the resulting string in "dest" is always null terminated + Copy a string from a ucs2 source to a unix char* destination. + Flags can have: + STR_TERMINATE means the string in src is null terminated. + STR_NOALIGN means don't try to align. + if STR_TERMINATE is set then src_len is ignored if it is -1. + src_len is the length of the source area in bytes + Return the number of bytes occupied by the string in src. + The resulting string in "dest" is always null terminated. ****************************************************************************/ -int pull_ucs2(const void *base_ptr, char *dest, const void *src, int dest_len, int src_len, int flags) + +size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags) { - int ret; + size_t ret; - if (dest_len == -1) { + if (dest_len == (size_t)-1) dest_len = sizeof(pstring); - } if (ucs2_align(base_ptr, src, flags)) { src = (const void *)((const char *)src + 1); - if (src_len > 0) src_len--; + if (src_len > 0) + src_len--; } if (flags & STR_TERMINATE) { - if (src_len == -1) { + if (src_len == (size_t)-1) { src_len = strlen_w(src)*2 + 2; } else { - int len = strnlen_w(src, src_len/2); - if (len < src_len/2) len++; + size_t len = strnlen_w(src, src_len/2); + if (len < src_len/2) + len++; src_len = len*2; } } /* ucs2 is always a multiple of 2 bytes */ - if (src_len != -1) + if (src_len != (size_t)-1) src_len &= ~1; ret = convert_string(CH_UCS2, CH_UNIX, src, src_len, dest, dest_len); - if (dest_len) dest[MIN(ret, dest_len-1)] = 0; + if (dest_len) + dest[MIN(ret, dest_len-1)] = 0; return src_len; } -int pull_ucs2_pstring(char *dest, const void *src) +size_t pull_ucs2_pstring(char *dest, const void *src) { return pull_ucs2(NULL, dest, src, sizeof(pstring), -1, STR_TERMINATE); } -int pull_ucs2_fstring(char *dest, const void *src) +size_t pull_ucs2_fstring(char *dest, const void *src) { return pull_ucs2(NULL, dest, src, sizeof(fstring), -1, STR_TERMINATE); } @@ -590,9 +604,10 @@ int pull_ucs2_fstring(char *dest, const void *src) * * @retval The number of bytes occupied by the string in the destination **/ -int pull_ucs2_talloc(TALLOC_CTX *ctx, void **dest, const char *src) + +size_t pull_ucs2_talloc(TALLOC_CTX *ctx, void **dest, const smb_ucs2_t *src) { - int src_len = strlen(src)+1; + size_t src_len = (strlen_w(src)+1) * sizeof(smb_ucs2_t); *dest = NULL; return convert_string_talloc(ctx, CH_UCS2, CH_UNIX, src, src_len, dest); } @@ -604,52 +619,55 @@ int pull_ucs2_talloc(TALLOC_CTX *ctx, void **dest, const char *src) * * @retval The number of bytes occupied by the string in the destination **/ -int pull_ucs2_allocate(void **dest, const char *src) + +size_t pull_ucs2_allocate(void **dest, const smb_ucs2_t *src) { - int src_len = strlen(src)+1; + size_t src_len = (strlen_w(src)+1) * sizeof(smb_ucs2_t); *dest = NULL; return convert_string_allocate(CH_UCS2, CH_UNIX, src, src_len, dest); } /**************************************************************************** -copy a string from a utf-8 source to a unix char* destination -flags can have: - STR_TERMINATE means the string in src is null terminated -if STR_TERMINATE is set then src_len is ignored -src_len is the length of the source area in bytes -return the number of bytes occupied by the string in src -the resulting string in "dest" is always null terminated + Copy a string from a utf-8 source to a unix char* destination. + Flags can have: + STR_TERMINATE means the string in src is null terminated. + if STR_TERMINATE is set then src_len is ignored. + src_len is the length of the source area in bytes + Return the number of bytes occupied by the string in src. + The resulting string in "dest" is always null terminated. ****************************************************************************/ -int pull_utf8(char *dest, const void *src, int dest_len, int src_len, int flags) + +size_t pull_utf8(char *dest, const void *src, size_t dest_len, size_t src_len, int flags) { - int ret; + size_t ret; - if (dest_len == -1) { + if (dest_len == (size_t)-1) dest_len = sizeof(pstring); - } if (flags & STR_TERMINATE) { - if (src_len == -1) { + if (src_len == (size_t)-1) { src_len = strlen(src) + 1; } else { - int len = strnlen(src, src_len); - if (len < src_len) len++; + size_t len = strnlen(src, src_len); + if (len < src_len) + len++; src_len = len; } } ret = convert_string(CH_UTF8, CH_UNIX, src, src_len, dest, dest_len); - if (dest_len) dest[MIN(ret, dest_len-1)] = 0; + if (dest_len) + dest[MIN(ret, dest_len-1)] = 0; return src_len; } -int pull_utf8_pstring(char *dest, const void *src) +size_t pull_utf8_pstring(char *dest, const void *src) { return pull_utf8(dest, src, sizeof(pstring), -1, STR_TERMINATE); } -int pull_utf8_fstring(char *dest, const void *src) +size_t pull_utf8_fstring(char *dest, const void *src) { return pull_utf8(dest, src, sizeof(fstring), -1, STR_TERMINATE); } @@ -661,9 +679,10 @@ int pull_utf8_fstring(char *dest, const void *src) * * @retval The number of bytes occupied by the string in the destination **/ -int pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src) + +size_t pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src) { - int src_len = strlen(src)+1; + size_t src_len = strlen(src)+1; *dest = NULL; return convert_string_talloc(ctx, CH_UTF8, CH_UNIX, src, src_len, (void **)dest); } @@ -675,27 +694,29 @@ int pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src) * * @retval The number of bytes occupied by the string in the destination **/ -int pull_utf8_allocate(void **dest, const char *src) + +size_t pull_utf8_allocate(void **dest, const char *src) { - int src_len = strlen(src)+1; + size_t src_len = strlen(src)+1; *dest = NULL; return convert_string_allocate(CH_UTF8, CH_UNIX, src, src_len, dest); } /**************************************************************************** -copy a string from a char* src to a unicode or ascii -dos codepage destination choosing unicode or ascii based on the -flags in the SMB buffer starting at base_ptr -return the number of bytes occupied by the string in the destination -flags can have: - STR_TERMINATE means include the null termination - STR_UPPER means uppercase in the destination - STR_ASCII use ascii even with unicode packet - STR_NOALIGN means don't do alignment -dest_len is the maximum length allowed in the destination. If dest_len -is -1 then no maxiumum is used + Copy a string from a char* src to a unicode or ascii + dos codepage destination choosing unicode or ascii based on the + flags in the SMB buffer starting at base_ptr. + Return the number of bytes occupied by the string in the destination. + flags can have: + STR_TERMINATE means include the null termination. + STR_UPPER means uppercase in the destination. + STR_ASCII use ascii even with unicode packet. + STR_NOALIGN means don't do alignment. + dest_len is the maximum length allowed in the destination. If dest_len + is -1 then no maxiumum is used. ****************************************************************************/ -int push_string(const void *base_ptr, void *dest, const char *src, int dest_len, int flags) + +size_t push_string(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags) { if (!(flags & STR_ASCII) && \ ((flags & STR_UNICODE || \ @@ -707,20 +728,20 @@ int push_string(const void *base_ptr, void *dest, const char *src, int dest_len, /**************************************************************************** -copy a string from a unicode or ascii source (depending on -the packet flags) to a char* destination -flags can have: - STR_TERMINATE means the string in src is null terminated - STR_UNICODE means to force as unicode - STR_ASCII use ascii even with unicode packet - STR_NOALIGN means don't do alignment -if STR_TERMINATE is set then src_len is ignored is it is -1 -src_len is the length of the source area in bytes -return the number of bytes occupied by the string in src -the resulting string in "dest" is always null terminated + Copy a string from a unicode or ascii source (depending on + the packet flags) to a char* destination. + Flags can have: + STR_TERMINATE means the string in src is null terminated. + STR_UNICODE means to force as unicode. + STR_ASCII use ascii even with unicode packet. + STR_NOALIGN means don't do alignment. + if STR_TERMINATE is set then src_len is ignored is it is -1 + src_len is the length of the source area in bytes. + Return the number of bytes occupied by the string in src. + The resulting string in "dest" is always null terminated. ****************************************************************************/ -int pull_string(const void *base_ptr, char *dest, const void *src, int dest_len, int src_len, - int flags) + +size_t pull_string(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags) { if (!(flags & STR_ASCII) && \ ((flags & STR_UNICODE || \ @@ -730,7 +751,7 @@ int pull_string(const void *base_ptr, char *dest, const void *src, int dest_len, return pull_ascii(dest, src, dest_len, src_len, flags); } -int align_string(const void *base_ptr, const char *p, int flags) +size_t align_string(const void *base_ptr, const char *p, int flags) { if (!(flags & STR_ASCII) && \ ((flags & STR_UNICODE || \ @@ -740,14 +761,13 @@ int align_string(const void *base_ptr, const char *p, int flags) return 0; } - - /**************************************************************************** -convert from ucs2 to unix charset and return the -allocated and converted string or NULL if an error occurred. -you must provide a zero terminated string. -the returning string will be zero terminated. + Convert from ucs2 to unix charset and return the + allocated and converted string or NULL if an error occurred. + You must provide a zero terminated string. + The returning string will be zero terminated. ****************************************************************************/ + char *acnv_u2ux(const smb_ucs2_t *src) { size_t slen; @@ -756,16 +776,19 @@ char *acnv_u2ux(const smb_ucs2_t *src) slen = (strlen_w(src) + 1) * sizeof(smb_ucs2_t); dlen = convert_string_allocate(CH_UCS2, CH_UNIX, src, slen, &dest); - if (dlen == -1) return NULL; - else return dest; + if (dlen == (size_t)-1) + return NULL; + else + return dest; } /**************************************************************************** -convert from unix to ucs2 charset and return the -allocated and converted string or NULL if an error occurred. -you must provide a zero terminated string. -the returning string will be zero terminated. + Convert from unix to ucs2 charset and return the + allocated and converted string or NULL if an error occurred. + You must provide a zero terminated string. + The returning string will be zero terminated. ****************************************************************************/ + smb_ucs2_t *acnv_uxu2(const char *src) { size_t slen; @@ -774,16 +797,19 @@ smb_ucs2_t *acnv_uxu2(const char *src) slen = strlen(src) + 1; dlen = convert_string_allocate(CH_UNIX, CH_UCS2, src, slen, &dest); - if (dlen == -1) return NULL; - else return dest; + if (dlen == (size_t)-1) + return NULL; + else + return dest; } /**************************************************************************** -convert from ucs2 to dos charset and return the -allocated and converted string or NULL if an error occurred. -you must provide a zero terminated string. -the returning string will be zero terminated. + Convert from ucs2 to dos charset and return the + allocated and converted string or NULL if an error occurred. + You must provide a zero terminated string. + The returning string will be zero terminated. ****************************************************************************/ + char *acnv_u2dos(const smb_ucs2_t *src) { size_t slen; @@ -792,16 +818,19 @@ char *acnv_u2dos(const smb_ucs2_t *src) slen = (strlen_w(src) + 1) * sizeof(smb_ucs2_t); dlen = convert_string_allocate(CH_UCS2, CH_DOS, src, slen, &dest); - if (dlen == -1) return NULL; - else return dest; + if (dlen == (size_t)-1) + return NULL; + else + return dest; } /**************************************************************************** -convert from dos to ucs2 charset and return the -allocated and converted string or NULL if an error occurred. -you must provide a zero terminated string. -the returning string will be zero terminated. + Convert from dos to ucs2 charset and return the + allocated and converted string or NULL if an error occurred. + You must provide a zero terminated string. + The returning string will be zero terminated. ****************************************************************************/ + smb_ucs2_t *acnv_dosu2(const char *src) { size_t slen; @@ -810,6 +839,8 @@ smb_ucs2_t *acnv_dosu2(const char *src) slen = strlen(src) + 1; dlen = convert_string_allocate(CH_DOS, CH_UCS2, src, slen, &dest); - if (dlen == -1) return NULL; - else return dest; + if (dlen == (size_t)-1) + return NULL; + else + return dest; } -- cgit From a3ccf4ae6d94c6ea509fe7379207e4185f486846 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 12 Nov 2002 15:18:12 +0000 Subject: Add smb_register_charset() and use it (This used to be commit 8b654658759a145c5c8aabb3c82220a70f70c3f7) --- source3/include/charset.h | 16 ++++++++ source3/lib/iconv.c | 98 +++++++++++++++++++++++++++++++---------------- 2 files changed, 81 insertions(+), 33 deletions(-) diff --git a/source3/include/charset.h b/source3/include/charset.h index 07d5e2d5993..d04f63abd1d 100644 --- a/source3/include/charset.h +++ b/source3/include/charset.h @@ -2,6 +2,7 @@ Unix SMB/CIFS implementation. charset defines Copyright (C) Andrew Tridgell 2001 + Copyright (C) Jelmer Vernooij 2002 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 @@ -22,3 +23,18 @@ typedef enum {CH_UCS2=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4} charset_t; #define NUM_CHARSETS 5 + +/* + * for each charset we have a function that pulls from that charset to + * a ucs2 buffer, and a function that pushes to a ucs2 buffer + * */ + +struct charset_functions { + char *name; + size_t (*pull)(void *, char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + size_t (*push)(void *, char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + struct charset_functions *prev, *next; +}; + diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c index 43350d93492..9b40abd291e 100644 --- a/source3/lib/iconv.c +++ b/source3/lib/iconv.c @@ -2,6 +2,7 @@ Unix SMB/CIFS implementation. minimal iconv implementation Copyright (C) Andrew Tridgell 2001 + Copyright (C) Jelmer Vernooij 2002 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 @@ -30,25 +31,48 @@ static size_t ucs2hex_pull(void *,char **, size_t *, char **, size_t *); static size_t ucs2hex_push(void *,char **, size_t *, char **, size_t *); static size_t iconv_copy(void *,char **, size_t *, char **, size_t *); -/* - for each charset we have a function that pulls from that charset to - a ucs2 buffer, and a function that pushes to a ucs2 buffer -*/ -static struct { - char *name; - size_t (*pull)(void *, char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft); - size_t (*push)(void *, char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft); -} charsets[] = { - {"UCS-2LE", iconv_copy, iconv_copy}, - {"UTF8", utf8_pull, utf8_push}, - {"ASCII", ascii_pull, ascii_push}, - {"WEIRD", weird_pull, weird_push}, - {"UCS2-HEX", ucs2hex_pull, ucs2hex_push}, - {NULL, NULL, NULL} +struct charset_functions builtin_functions[] = { + {"UCS-2LE", iconv_copy, iconv_copy}, + {"UTF8", utf8_pull, utf8_push}, + {"ASCII", ascii_pull, ascii_push}, + {"WEIRD", weird_pull, weird_push}, + {"UCS2-HEX", ucs2hex_pull, ucs2hex_push}, + {NULL, NULL, NULL} }; +static struct charset_functions *charsets = NULL; + +BOOL smb_register_charset(struct charset_functions *funcs) +{ + struct charset_functions *c = charsets; + + DEBUG(5, ("Attempting to register new charset %s\n", funcs->name)); + /* Check whether we already have this charset... */ + while(c) { + if(!strcasecmp(c->name, funcs->name)){ + DEBUG(2, ("Duplicate charset %s, not registering\n", funcs->name)); + return False; + } + c = c->next; + } + + funcs->next = funcs->prev = NULL; + DEBUG(5, ("Registered charset %s\n", c->name)); + DLIST_ADD(charsets, funcs); + return True; +} + +void lazy_initialize_iconv(void) +{ + static BOOL initialized = False; + int i; + + if (!initialized) { + initialized = True; + for(i = 0; builtin_functions[i].name; i++) + smb_register_charset(&builtin_functions[i]); + } +} /* if there was an error then reset the internal state, this ensures that we don't have a shift state remaining for @@ -115,7 +139,11 @@ size_t smb_iconv(smb_iconv_t cd, smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode) { smb_iconv_t ret; - int from, to; + struct charset_functions *from, *to; + + lazy_initialize_iconv(); + from = charsets; + to = charsets; ret = (smb_iconv_t)malloc(sizeof(*ret)); if (!ret) { @@ -133,48 +161,52 @@ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode) return ret; } - for (from=0; charsets[from].name; from++) { - if (strcasecmp(charsets[from].name, fromcode) == 0) break; + while (from) { + if (strcasecmp(from->name, fromcode) == 0) break; + from = from->next; } - for (to=0; charsets[to].name; to++) { - if (strcasecmp(charsets[to].name, tocode) == 0) break; + + while (to) { + if (strcasecmp(to->name, tocode) == 0) break; + to = to->next; } #ifdef HAVE_NATIVE_ICONV - if (!charsets[from].name) { + if (!from) { ret->pull = sys_iconv; ret->cd_pull = iconv_open("UCS-2LE", fromcode); if (ret->cd_pull == (iconv_t)-1) goto failed; } - if (!charsets[to].name) { + + if (!to) { ret->push = sys_iconv; ret->cd_push = iconv_open(tocode, "UCS-2LE"); if (ret->cd_push == (iconv_t)-1) goto failed; } #else - if (!charsets[from].name || !charsets[to].name) { + if (!from || !to) { goto failed; } #endif /* check for conversion to/from ucs2 */ - if (from == 0 && charsets[to].name) { - ret->direct = charsets[to].push; + if (strcasecmp(fromcode, "UCS-2LE") == 0 && to) { + ret->direct = to->push; return ret; } - if (to == 0 && charsets[from].name) { - ret->direct = charsets[from].pull; + if (strcasecmp(tocode, "UCS-2LE") == 0 && from) { + ret->direct = from->pull; return ret; } #ifdef HAVE_NATIVE_ICONV - if (from == 0) { + if (strcasecmp(fromcode, "UCS-2LE") == 0) { ret->direct = sys_iconv; ret->cd_direct = ret->cd_push; ret->cd_push = NULL; return ret; } - if (to == 0) { + if (strcasecmp(tocode, "UCS-2LE") == 0) { ret->direct = sys_iconv; ret->cd_direct = ret->cd_pull; ret->cd_pull = NULL; @@ -183,8 +215,8 @@ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode) #endif /* the general case has to go via a buffer */ - if (!ret->pull) ret->pull = charsets[from].pull; - if (!ret->push) ret->push = charsets[to].push; + if (!ret->pull) ret->pull = from->pull; + if (!ret->push) ret->push = to->push; return ret; failed: -- cgit From 7b8697dccbb5028519dac4d4c6dcd07e5fe4760c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 12 Nov 2002 18:07:51 +0000 Subject: Fix segfault with high debug levels (This used to be commit a20676bc05f50bb89a55e67efef579eaaeac3f72) --- source3/lib/iconv.c | 110 +--------------------------------------------------- 1 file changed, 1 insertion(+), 109 deletions(-) diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c index 9b40abd291e..e54a74864e1 100644 --- a/source3/lib/iconv.c +++ b/source3/lib/iconv.c @@ -25,8 +25,6 @@ static size_t ascii_pull(void *,char **, size_t *, char **, size_t *); static size_t ascii_push(void *,char **, size_t *, char **, size_t *); static size_t utf8_pull(void *,char **, size_t *, char **, size_t *); static size_t utf8_push(void *,char **, size_t *, char **, size_t *); -static size_t weird_pull(void *,char **, size_t *, char **, size_t *); -static size_t weird_push(void *,char **, size_t *, char **, size_t *); static size_t ucs2hex_pull(void *,char **, size_t *, char **, size_t *); static size_t ucs2hex_push(void *,char **, size_t *, char **, size_t *); static size_t iconv_copy(void *,char **, size_t *, char **, size_t *); @@ -35,7 +33,6 @@ struct charset_functions builtin_functions[] = { {"UCS-2LE", iconv_copy, iconv_copy}, {"UTF8", utf8_pull, utf8_push}, {"ASCII", ascii_pull, ascii_push}, - {"WEIRD", weird_pull, weird_push}, {"UCS2-HEX", ucs2hex_pull, ucs2hex_push}, {NULL, NULL, NULL} }; @@ -57,7 +54,7 @@ BOOL smb_register_charset(struct charset_functions *funcs) } funcs->next = funcs->prev = NULL; - DEBUG(5, ("Registered charset %s\n", c->name)); + DEBUG(5, ("Registered charset %s\n", funcs->name)); DLIST_ADD(charsets, funcs); return True; } @@ -384,111 +381,6 @@ static size_t ucs2hex_push(void *cd, char **inbuf, size_t *inbytesleft, } -/* the "weird" character set is very useful for testing multi-byte - support and finding bugs. Don't use on a production system! -*/ -static struct { - char from; - char *to; - int len; -} weird_table[] = { - {'q', "^q^", 3}, - {'Q', "^Q^", 3}, - {0, NULL} -}; - -static size_t weird_pull(void *cd, char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft) -{ - while (*inbytesleft >= 1 && *outbytesleft >= 2) { - int i; - int done = 0; - for (i=0;weird_table[i].from;i++) { - if (strncmp((*inbuf), - weird_table[i].to, - weird_table[i].len) == 0) { - if (*inbytesleft < weird_table[i].len) { - DEBUG(0,("ERROR: truncated weird string\n")); - /* smb_panic("weird_pull"); */ - - } else { - (*outbuf)[0] = weird_table[i].from; - (*outbuf)[1] = 0; - (*inbytesleft) -= weird_table[i].len; - (*outbytesleft) -= 2; - (*inbuf) += weird_table[i].len; - (*outbuf) += 2; - done = 1; - break; - } - } - } - if (done) continue; - (*outbuf)[0] = (*inbuf)[0]; - (*outbuf)[1] = 0; - (*inbytesleft) -= 1; - (*outbytesleft) -= 2; - (*inbuf) += 1; - (*outbuf) += 2; - } - - if (*inbytesleft > 0) { - errno = E2BIG; - return -1; - } - - return 0; -} - -static size_t weird_push(void *cd, char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft) -{ - int ir_count=0; - - while (*inbytesleft >= 2 && *outbytesleft >= 1) { - int i; - int done=0; - for (i=0;weird_table[i].from;i++) { - if ((*inbuf)[0] == weird_table[i].from && - (*inbuf)[1] == 0) { - if (*outbytesleft < weird_table[i].len) { - DEBUG(0,("No room for weird character\n")); - /* smb_panic("weird_push"); */ - } else { - memcpy(*outbuf, weird_table[i].to, - weird_table[i].len); - (*inbytesleft) -= 2; - (*outbytesleft) -= weird_table[i].len; - (*inbuf) += 2; - (*outbuf) += weird_table[i].len; - done = 1; - break; - } - } - } - if (done) continue; - - (*outbuf)[0] = (*inbuf)[0]; - if ((*inbuf)[1]) ir_count++; - (*inbytesleft) -= 2; - (*outbytesleft) -= 1; - (*inbuf) += 2; - (*outbuf) += 1; - } - - if (*inbytesleft == 1) { - errno = EINVAL; - return -1; - } - - if (*inbytesleft > 1) { - errno = E2BIG; - return -1; - } - - return ir_count; -} - static size_t iconv_copy(void *cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { -- cgit From b6f84a37a9cc46a310b9124bc78151902bd9f92b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 12 Nov 2002 18:11:00 +0000 Subject: Don't throw out WEIRD - yet (I committed my local changes together with my last fix. D'oh!) (This used to be commit 5191719eeec7062118da2be3aefe35d065e97900) --- source3/lib/iconv.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c index e54a74864e1..3498f976b3e 100644 --- a/source3/lib/iconv.c +++ b/source3/lib/iconv.c @@ -25,6 +25,8 @@ static size_t ascii_pull(void *,char **, size_t *, char **, size_t *); static size_t ascii_push(void *,char **, size_t *, char **, size_t *); static size_t utf8_pull(void *,char **, size_t *, char **, size_t *); static size_t utf8_push(void *,char **, size_t *, char **, size_t *); +static size_t weird_pull(void *,char **, size_t *, char **, size_t *); +static size_t weird_push(void *,char **, size_t *, char **, size_t *); static size_t ucs2hex_pull(void *,char **, size_t *, char **, size_t *); static size_t ucs2hex_push(void *,char **, size_t *, char **, size_t *); static size_t iconv_copy(void *,char **, size_t *, char **, size_t *); @@ -33,6 +35,7 @@ struct charset_functions builtin_functions[] = { {"UCS-2LE", iconv_copy, iconv_copy}, {"UTF8", utf8_pull, utf8_push}, {"ASCII", ascii_pull, ascii_push}, + {"WEIRD", weird_pull, weird_push}, {"UCS2-HEX", ucs2hex_pull, ucs2hex_push}, {NULL, NULL, NULL} }; @@ -381,6 +384,111 @@ static size_t ucs2hex_push(void *cd, char **inbuf, size_t *inbytesleft, } +/* the "weird" character set is very useful for testing multi-byte + support and finding bugs. Don't use on a production system! +*/ +static struct { + char from; + char *to; + int len; +} weird_table[] = { + {'q', "^q^", 3}, + {'Q', "^Q^", 3}, + {0, NULL} +}; + +static size_t weird_pull(void *cd, char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + while (*inbytesleft >= 1 && *outbytesleft >= 2) { + int i; + int done = 0; + for (i=0;weird_table[i].from;i++) { + if (strncmp((*inbuf), + weird_table[i].to, + weird_table[i].len) == 0) { + if (*inbytesleft < weird_table[i].len) { + DEBUG(0,("ERROR: truncated weird string\n")); + /* smb_panic("weird_pull"); */ + + } else { + (*outbuf)[0] = weird_table[i].from; + (*outbuf)[1] = 0; + (*inbytesleft) -= weird_table[i].len; + (*outbytesleft) -= 2; + (*inbuf) += weird_table[i].len; + (*outbuf) += 2; + done = 1; + break; + } + } + } + if (done) continue; + (*outbuf)[0] = (*inbuf)[0]; + (*outbuf)[1] = 0; + (*inbytesleft) -= 1; + (*outbytesleft) -= 2; + (*inbuf) += 1; + (*outbuf) += 2; + } + + if (*inbytesleft > 0) { + errno = E2BIG; + return -1; + } + + return 0; +} + +static size_t weird_push(void *cd, char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + int ir_count=0; + + while (*inbytesleft >= 2 && *outbytesleft >= 1) { + int i; + int done=0; + for (i=0;weird_table[i].from;i++) { + if ((*inbuf)[0] == weird_table[i].from && + (*inbuf)[1] == 0) { + if (*outbytesleft < weird_table[i].len) { + DEBUG(0,("No room for weird character\n")); + /* smb_panic("weird_push"); */ + } else { + memcpy(*outbuf, weird_table[i].to, + weird_table[i].len); + (*inbytesleft) -= 2; + (*outbytesleft) -= weird_table[i].len; + (*inbuf) += 2; + (*outbuf) += weird_table[i].len; + done = 1; + break; + } + } + } + if (done) continue; + + (*outbuf)[0] = (*inbuf)[0]; + if ((*inbuf)[1]) ir_count++; + (*inbytesleft) -= 2; + (*outbytesleft) -= 1; + (*inbuf) += 2; + (*outbuf) += 1; + } + + if (*inbytesleft == 1) { + errno = EINVAL; + return -1; + } + + if (*inbytesleft > 1) { + errno = E2BIG; + return -1; + } + + return ir_count; +} + static size_t iconv_copy(void *cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { -- cgit From cf671ca0dfa51eed5aa5d0d25996faf8fec7552a Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 12 Nov 2002 21:40:37 +0000 Subject: Remove non-integer Pointer values, which are no longer supported. (This used to be commit 4a18526257ec4582679efa7a21d0b31ad07992fb) --- source3/python/examples/tdbpack/test_tdbpack.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/source3/python/examples/tdbpack/test_tdbpack.py b/source3/python/examples/tdbpack/test_tdbpack.py index 83282e745e4..d3364542740 100755 --- a/source3/python/examples/tdbpack/test_tdbpack.py +++ b/source3/python/examples/tdbpack/test_tdbpack.py @@ -113,8 +113,6 @@ class PackTests(unittest.TestCase): not "canonical". """ cases = [('w', (42,), '\x2a\0'), - ('p', [None], '\0\0\0\0'), - ('p', ['true'], '\x01\0\0\0'), ] for packer in both_packers: -- cgit From 7031a02c013fd93b7a4b410996057e3ff9126f89 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 12 Nov 2002 21:42:36 +0000 Subject: Remove dead code for packing buffers which has now been reimplemented. (This used to be commit 62ca27d140d55cbb271b97624023540ae7c18882) --- source3/python/py_tdbpack.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/source3/python/py_tdbpack.c b/source3/python/py_tdbpack.c index 7180c3e12cf..12e38181237 100644 --- a/source3/python/py_tdbpack.c +++ b/source3/python/py_tdbpack.c @@ -378,42 +378,6 @@ pytdbpack_buffer(PyObject *val_iter, PyObject *packed_list) } -#if 0 -else if (ch == 'B') { - long size; - char *sval; - - if (!PyNumber_Check(val_obj)) { - pytdbpack_bad_type(ch, "Number", val_obj); - return NULL; - } - - if (!(val_obj = PyNumber_Long(val_obj))) - return NULL; - - size = PyLong_AsLong(val_obj); - pack_le_uint32(size, &packed); - - /* Release the new reference created by the cast */ - Py_DECREF(val_obj); - - val_obj = PySequence_GetItem(val_seq, val_i++); - if (!val_obj) - return NULL; - - sval = PyString_AsString(val_obj); - if (!sval) - return NULL; - - pack_bytes(size, sval, &packed); /* do not include nul */ - } - else { - - } - - return Py_None; -} -#endif static PyObject * pytdbpack_unpack(PyObject *self, -- cgit From 664a5061e020c5c83deb32c63a1a4bd298beffd4 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 12 Nov 2002 22:00:57 +0000 Subject: Remove dead code for packing buffers which has now been reimplemented. (This used to be commit 001779dffd18e1f6a83496c94ead185d4bb42204) --- source3/python/py_tdbpack.c | 94 --------------------------------------------- 1 file changed, 94 deletions(-) diff --git a/source3/python/py_tdbpack.c b/source3/python/py_tdbpack.c index 12e38181237..3f7d21604b2 100644 --- a/source3/python/py_tdbpack.c +++ b/source3/python/py_tdbpack.c @@ -449,100 +449,6 @@ pytdbpack_unpack(PyObject *self, -#if 0 -/* - Internal routine that calculates how many bytes will be required to - encode the values in the format. - - Also checks that the value list is the right size for the format list. - - Returns number of bytes (may be 0), or -1 if there's something wrong, in - which case a Python exception has been raised. - - Arguments: - - val_seq: a Fast Sequence (list or tuple), being all the values -*/ -static int -pytdbpack_calc_reqd_len(char *format_str, - PyObject *val_seq) -{ - int len = 0; - char *p; - int val_i; - int val_len; - - val_len = PySequence_Length(val_seq); - if (val_len == -1) - return -1; - - for (p = format_str, val_i = 0; *p; p++, val_i++) { - char ch = *p; - - if (val_i >= val_len) { - PyErr_Format(PyExc_IndexError, - "%s: value list is too short for format string", - __FUNCTION__); - return -1; - } - - /* borrow a reference to the item */ - if (ch == 'd' || ch == 'p') - len += 4; - else if (ch == 'w') - len += 2; - else if (ch == 'f' || ch == 'P') { - /* nul-terminated 8-bit string */ - int item_len; - PyObject *str_obj; - - str_obj = PySequence_GetItem(val_seq, val_i); - if (!str_obj) - return -1; - - if (!PyString_Check(str_obj) || ((item_len = PyString_Size(str_obj)) == -1)) { - pytdbpack_bad_type(ch, "String", str_obj); - return -1; - } - - len += 1 + item_len; - } - else if (ch == 'B') { - /* length-preceded byte buffer: n bytes, plus a preceding - * word */ - PyObject *len_obj; - long len_val; - - len_obj = PySequence_GetItem(val_seq, val_i); - val_i++; /* skip over buffer */ - - if (!PyNumber_Check(len_obj)) { - pytdbpack_bad_type(ch, "Number", len_obj); - return -1; - } - - len_val = PyInt_AsLong(len_obj); - if (len_val < 0) { - PyErr_Format(PyExc_ValueError, - "%s: format 'B' requires positive integer", __FUNCTION__); - return -1; - } - - len += 4 + len_val; - } - else { - PyErr_Format(PyExc_ValueError, - "%s: format character '%c' is not supported", - __FUNCTION__, ch); - - return -1; - } - } - - return len; -} -#endif - static PyObject *pytdbpack_bad_type(char ch, const char *expected, -- cgit From 5d3bc0bc838f1b25b2edfb14af74a091c4d41c08 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 12 Nov 2002 22:07:11 +0000 Subject: Just reorder functions to put related ones together (This used to be commit 7863c948b73785e49d04227e87d8b4b47fd61f58) --- source3/python/py_tdbpack.c | 78 ++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/source3/python/py_tdbpack.c b/source3/python/py_tdbpack.c index 3f7d21604b2..ba22fc3a633 100644 --- a/source3/python/py_tdbpack.c +++ b/source3/python/py_tdbpack.c @@ -378,6 +378,44 @@ pytdbpack_buffer(PyObject *val_iter, PyObject *packed_list) } +static PyObject *pytdbpack_bad_type(char ch, + const char *expected, + PyObject *val_obj) +{ + PyObject *r = PyObject_Repr(val_obj); + if (!r) + return NULL; + PyErr_Format(PyExc_TypeError, + "tdbpack: format '%c' requires %s, not %s", + ch, expected, PyString_AS_STRING(r)); + Py_DECREF(r); + return val_obj; +} + + +/* + XXX: glib and Samba have quicker macro for doing the endianness conversions, + but I don't know of one in plain libc, and it's probably not a big deal. I + realize this is kind of dumb because we'll almost always be on x86, but + being safe is important. +*/ +static void pack_le_uint32(unsigned long val_long, unsigned char *pbuf) +{ + pbuf[0] = val_long & 0xff; + pbuf[1] = (val_long >> 8) & 0xff; + pbuf[2] = (val_long >> 16) & 0xff; + pbuf[3] = (val_long >> 24) & 0xff; +} + + +static void pack_bytes(long len, const char *from, + unsigned char **pbuf) +{ + memcpy(*pbuf, from, len); + (*pbuf) += len; +} + + static PyObject * pytdbpack_unpack(PyObject *self, @@ -448,46 +486,6 @@ pytdbpack_unpack(PyObject *self, } - - -static PyObject *pytdbpack_bad_type(char ch, - const char *expected, - PyObject *val_obj) -{ - PyObject *r = PyObject_Repr(val_obj); - if (!r) - return NULL; - PyErr_Format(PyExc_TypeError, - "tdbpack: format '%c' requires %s, not %s", - ch, expected, PyString_AS_STRING(r)); - Py_DECREF(r); - return val_obj; -} - - -/* - XXX: glib and Samba have quicker macro for doing the endianness conversions, - but I don't know of one in plain libc, and it's probably not a big deal. I - realize this is kind of dumb because we'll almost always be on x86, but - being safe is important. -*/ -static void pack_le_uint32(unsigned long val_long, unsigned char *pbuf) -{ - pbuf[0] = val_long & 0xff; - pbuf[1] = (val_long >> 8) & 0xff; - pbuf[2] = (val_long >> 16) & 0xff; - pbuf[3] = (val_long >> 24) & 0xff; -} - - -static void pack_bytes(long len, const char *from, - unsigned char **pbuf) -{ - memcpy(*pbuf, from, len); - (*pbuf) += len; -} - - static void unpack_err_too_short(void) { -- cgit From 9b7c4c1c8167c27e02b5de41023fb39eea530d83 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 12 Nov 2002 22:08:59 +0000 Subject: Rename pytdbpack_unpack -> pytdbunpack (This used to be commit e62baf3a76e0e4f642e542812868db614632de00) --- source3/python/py_tdbpack.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source3/python/py_tdbpack.c b/source3/python/py_tdbpack.c index ba22fc3a633..b4df985fb8d 100644 --- a/source3/python/py_tdbpack.c +++ b/source3/python/py_tdbpack.c @@ -31,7 +31,7 @@ static PyObject * pytdbpack_number(char ch, PyObject *val_iter, PyObject *packed static PyObject * pytdbpack_str_850(PyObject *val_iter, PyObject *packed_list); static PyObject * pytdbpack_buffer(PyObject *val_iter, PyObject *packed_list); -static PyObject *pytdbpack_unpack_item(char, char **pbuf, int *plen, PyObject *); +static PyObject *pytdbunpack_item(char, char **pbuf, int *plen, PyObject *); static PyObject *pytdbpack_data(const char *format_str, PyObject *val_seq, @@ -117,7 +117,7 @@ notes: "; -static char const pytdbpack_unpack_doc[] = +static char const pytdbunpack_doc[] = "unpack(format, buffer) -> (values, rest) Unpack Samba binary data according to format string. @@ -418,7 +418,7 @@ static void pack_bytes(long len, const char *from, static PyObject * -pytdbpack_unpack(PyObject *self, +pytdbunpack(PyObject *self, PyObject *args) { char *format_str, *packed_str, *ppacked; @@ -447,7 +447,7 @@ pytdbpack_unpack(PyObject *self, for (ppacked = packed_str, i = 0; i < format_len && format_str[i] != '$'; i++) { last_format = format_str[i]; /* packed_len is reduced in place */ - if (!pytdbpack_unpack_item(format_str[i], &ppacked, &packed_len, val_list)) + if (!pytdbunpack_item(format_str[i], &ppacked, &packed_len, val_list)) goto failed; } @@ -460,7 +460,7 @@ pytdbpack_unpack(PyObject *self, return NULL; } while (packed_len > 0) - if (!pytdbpack_unpack_item(last_format, &ppacked, &packed_len, val_list)) + if (!pytdbunpack_item(last_format, &ppacked, &packed_len, val_list)) goto failed; } @@ -625,7 +625,7 @@ unpack_buffer(char **pbuf, int *plen, PyObject *val_list) Returns a reference to None, or NULL for failure. */ -static PyObject *pytdbpack_unpack_item(char ch, +static PyObject *pytdbunpack_item(char ch, char **pbuf, int *plen, PyObject *val_list) @@ -669,7 +669,7 @@ static PyObject *pytdbpack_unpack_item(char ch, static PyMethodDef pytdbpack_methods[] = { { "pack", pytdbpack, METH_VARARGS, (char *) pytdbpack_doc }, - { "unpack", pytdbpack_unpack, METH_VARARGS, (char *) pytdbpack_unpack_doc }, + { "unpack", pytdbunpack, METH_VARARGS, (char *) pytdbunpack_doc }, }; DL_EXPORT(void) -- cgit From 477025a6f628fd1a8d3bfacd30726e7a41819e50 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 12 Nov 2002 22:23:36 +0000 Subject: Rename unpack_* functions to be consistent Decode CP850 strings when unpacking Add variable giving default encoding name (This used to be commit 8cbaea2afa6faca80eced70d625359165afaa10c) --- source3/python/py_tdbpack.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/source3/python/py_tdbpack.c b/source3/python/py_tdbpack.c index b4df985fb8d..d8c3d467738 100644 --- a/source3/python/py_tdbpack.c +++ b/source3/python/py_tdbpack.c @@ -145,6 +145,7 @@ notes: "; +const char *pytdb_string_encoding = "cp850"; /* @@ -324,7 +325,7 @@ pytdbpack_str_850(PyObject *val_iter, PyObject *packed_list) val_obj = NULL; } - if (!(cp850_str = PyUnicode_AsEncodedString(unicode_obj, "cp850", NULL))) + if (!(cp850_str = PyUnicode_AsEncodedString(unicode_obj, pytdb_string_encoding, NULL))) goto out; if (!nul_str) @@ -487,7 +488,7 @@ pytdbunpack(PyObject *self, static void -unpack_err_too_short(void) +pytdbunpack_err_too_short(void) { PyErr_Format(PyExc_IndexError, __FUNCTION__ ": data too short for unpack format"); @@ -495,13 +496,13 @@ unpack_err_too_short(void) static PyObject * -unpack_uint32(char **pbuf, int *plen) +pytdbunpack_uint32(char **pbuf, int *plen) { unsigned long v; unsigned char *b; if (*plen < 4) { - unpack_err_too_short(); + pytdbunpack_err_too_short(); return NULL; } @@ -515,13 +516,13 @@ unpack_uint32(char **pbuf, int *plen) } -static PyObject *unpack_int16(char **pbuf, int *plen) +static PyObject *pytdbunpack_int16(char **pbuf, int *plen) { long v; unsigned char *b; if (*plen < 2) { - unpack_err_too_short(); + pytdbunpack_err_too_short(); return NULL; } @@ -536,7 +537,7 @@ static PyObject *unpack_int16(char **pbuf, int *plen) static PyObject * -unpack_string(char **pbuf, int *plen) +pytdbunpack_string(char **pbuf, int *plen) { int len; char *nul_ptr, *start; @@ -545,7 +546,7 @@ unpack_string(char **pbuf, int *plen) nul_ptr = memchr(start, '\0', *plen); if (!nul_ptr) { - unpack_err_too_short(); + pytdbunpack_err_too_short(); return NULL; } @@ -554,12 +555,12 @@ unpack_string(char **pbuf, int *plen) *pbuf += len + 1; /* skip \0 */ *plen -= len + 1; - return PyString_FromStringAndSize(start, len); + return PyString_Decode(start, len, pytdb_string_encoding, NULL); } static PyObject * -unpack_buffer(char **pbuf, int *plen, PyObject *val_list) +pytdbunpack_buffer(char **pbuf, int *plen, PyObject *val_list) { /* first get 32-bit len */ long slen; @@ -568,7 +569,7 @@ unpack_buffer(char **pbuf, int *plen, PyObject *val_list) PyObject *str_obj = NULL, *len_obj = NULL; if (*plen < 4) { - unpack_err_too_short(); + pytdbunpack_err_too_short(); return NULL; } @@ -633,17 +634,17 @@ static PyObject *pytdbunpack_item(char ch, PyObject *result; if (ch == 'w') { /* 16-bit int */ - result = unpack_int16(pbuf, plen); + result = pytdbunpack_int16(pbuf, plen); } else if (ch == 'd' || ch == 'p') { /* 32-bit int */ /* pointers can just come through as integers */ - result = unpack_uint32(pbuf, plen); + result = pytdbunpack_uint32(pbuf, plen); } else if (ch == 'f' || ch == 'P') { /* nul-term string */ - result = unpack_string(pbuf, plen); + result = pytdbunpack_string(pbuf, plen); } else if (ch == 'B') { /* length, buffer */ - return unpack_buffer(pbuf, plen, val_list); + return pytdbunpack_buffer(pbuf, plen, val_list); } else { PyErr_Format(PyExc_ValueError, -- cgit From 250c9801197ea1c949bd94c1c891f81ab118b130 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 Nov 2002 23:15:52 +0000 Subject: Removed global_myworkgroup, global_myname, global_myscope. Added liberal dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit 82b8f749a36b42e22186297482aad2abb04fab8a) --- source3/auth/auth.c | 2 +- source3/auth/auth_domain.c | 15 +- source3/auth/auth_sam.c | 4 +- source3/auth/auth_server.c | 10 +- source3/auth/auth_util.c | 1 - source3/client/client.c | 19 +- source3/client/smbspool.c | 14 +- source3/groupdb/mapping.c | 2 +- source3/lib/access.c | 165 ++-- source3/lib/interface.c | 4 +- source3/lib/popt_common.c | 4 +- source3/lib/substitute.c | 7 +- source3/lib/username.c | 4 +- source3/lib/util.c | 1383 +++++++++++++++++++--------------- source3/lib/util_sid.c | 12 +- source3/lib/util_sock.c | 2 +- source3/lib/util_str.c | 15 +- source3/lib/wins_srv.c | 14 +- source3/libads/kerberos_verify.c | 3 +- source3/libads/ldap.c | 38 +- source3/libads/ldap_printer.c | 9 +- source3/libads/sasl.c | 3 +- source3/libsmb/cliconnect.c | 51 +- source3/libsmb/namequery.c | 17 +- source3/libsmb/nmblib.c | 31 +- source3/libsmb/passchange.c | 5 +- source3/libsmb/pwd_cache.c | 14 +- source3/libsmb/trust_passwd.c | 6 +- source3/nmbd/nmbd.c | 102 +-- source3/nmbd/nmbd_become_dmb.c | 25 +- source3/nmbd/nmbd_become_lmb.c | 32 +- source3/nmbd/nmbd_browsesync.c | 17 +- source3/nmbd/nmbd_elections.c | 23 +- source3/nmbd/nmbd_incomingdgrams.c | 30 +- source3/nmbd/nmbd_incomingrequests.c | 15 +- source3/nmbd/nmbd_logonnames.c | 19 +- source3/nmbd/nmbd_mynames.c | 27 +- source3/nmbd/nmbd_namelistdb.c | 4 +- source3/nmbd/nmbd_nameregister.c | 6 +- source3/nmbd/nmbd_packets.c | 14 +- source3/nmbd/nmbd_processlogon.c | 22 +- source3/nmbd/nmbd_sendannounce.c | 66 +- source3/nmbd/nmbd_serverlistdb.c | 31 +- source3/nmbd/nmbd_subnetdb.c | 3 - source3/nmbd/nmbd_synclists.c | 2 +- source3/nmbd/nmbd_workgroupdb.c | 15 +- source3/nsswitch/wbinfo.c | 25 +- source3/nsswitch/winbindd.c | 14 +- source3/nsswitch/winbindd_cm.c | 9 +- source3/nsswitch/winbindd_misc.c | 4 +- source3/nsswitch/winbindd_pam.c | 22 +- source3/nsswitch/winbindd_util.c | 9 +- source3/param/loadparm.c | 536 ++++++------- source3/passdb/machine_sid.c | 7 +- source3/passdb/passdb.c | 14 +- source3/passdb/pdb_interface.c | 4 +- source3/passdb/pdb_ldap.c | 8 +- source3/passdb/util_sam_sid.c | 11 +- source3/printing/lpq_parse.c | 40 +- source3/rpc_client/cli_netlogon.c | 23 +- source3/rpc_client/cli_pipe.c | 18 +- source3/rpc_parse/parse_misc.c | 31 +- source3/rpc_parse/parse_net.c | 31 +- source3/rpc_parse/parse_rpc.c | 4 +- source3/rpc_parse/parse_samr.c | 4 +- source3/rpc_parse/parse_srv.c | 12 +- source3/rpc_server/srv_dfs.c | 2 - source3/rpc_server/srv_dfs_nt.c | 10 +- source3/rpc_server/srv_lsa_nt.c | 41 +- source3/rpc_server/srv_netlog_nt.c | 5 +- source3/rpc_server/srv_samr_nt.c | 16 +- source3/rpc_server/srv_spoolss_nt.c | 4 +- source3/rpc_server/srv_srvsvc_nt.c | 8 +- source3/rpc_server/srv_wkssvc_nt.c | 4 +- source3/rpcclient/rpcclient.c | 12 +- source3/script/mkproto.awk | 4 +- source3/smbd/change_trust_pw.c | 10 +- source3/smbd/chgpasswd.c | 2 +- source3/smbd/lanman.c | 18 +- source3/smbd/negprot.c | 6 +- source3/smbd/password.c | 12 +- source3/smbd/process.c | 18 +- source3/smbd/reply.c | 3 +- source3/smbd/server.c | 23 +- source3/smbd/service.c | 4 +- source3/smbd/sesssetup.c | 5 +- source3/smbd/trans2.c | 3 +- source3/smbd/uid.c | 6 +- source3/utils/net.c | 31 +- source3/utils/net_ads.c | 45 +- source3/utils/net_ads_cldap.c | 3 +- source3/utils/net_rpc.c | 11 +- source3/utils/net_rpc_join.c | 8 +- source3/utils/net_time.c | 3 +- source3/utils/nmblookup.c | 8 +- source3/utils/pdbedit.c | 17 +- source3/utils/smbcacls.c | 18 +- source3/utils/smbcontrol.c | 2 +- source3/utils/smbgroupedit.c | 16 +- source3/utils/smbpasswd.c | 10 +- source3/utils/testparm.c | 6 +- source3/wrepld/server.c | 30 +- 102 files changed, 1662 insertions(+), 1895 deletions(-) diff --git a/source3/auth/auth.c b/source3/auth/auth.c index d43afc71e14..232d401a240 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -137,7 +137,7 @@ static BOOL check_domain_match(const char *user, const char *domain) if (!lp_allow_trusted_domains() && !(strequal("", domain) || strequal(lp_workgroup(), domain) || - is_netbios_alias_or_name(domain))) { + is_myname(domain))) { DEBUG(1, ("check_domain_match: Attempt to connect as user %s from domain %s denied.\n", user, domain)); return False; } else { diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c index 9d4824fbc7b..2a6614e28e6 100644 --- a/source3/auth/auth_domain.c +++ b/source3/auth/auth_domain.c @@ -26,7 +26,6 @@ BOOL global_machine_password_needs_changing = False; -extern pstring global_myname; extern userdom_struct current_user_info; @@ -172,7 +171,7 @@ static NTSTATUS connect_to_domain_password_server(struct cli_state **cli, return NT_STATUS_NO_LOGON_SERVERS; /* Attempt connection */ - result = cli_full_connection(cli, global_myname, remote_machine, + result = cli_full_connection(cli, global_myname(), remote_machine, &dest_ip, 0, "IPC$", "IPC", "", "", "",0, retry); if (!NT_STATUS_IS_OK(result)) { @@ -250,7 +249,7 @@ static NTSTATUS attempt_connect_to_dc(struct cli_state **cli, if (is_zero_ip(*ip)) return NT_STATUS_NO_LOGON_SERVERS; - if (!lookup_dc_name(global_myname, domain, ip, dc_name)) + if (!lookup_dc_name(global_myname(), domain, ip, dc_name)) return NT_STATUS_NO_LOGON_SERVERS; for (i = 0; (!NT_STATUS_IS_OK(ret)) && retry && (i < 3); i++) @@ -372,7 +371,7 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx, const char *domain, uchar chal[8], auth_serversupplied_info **server_info, - char *server, char *setup_creds_as, + const char *server, const char *setup_creds_as, uint16 sec_chan, unsigned char trust_passwd[16], time_t last_change_time) @@ -481,7 +480,7 @@ static NTSTATUS check_ntdomain_security(const struct auth_context *auth_context, char *password_server; unsigned char trust_passwd[16]; time_t last_change_time; - char *domain = lp_workgroup(); + const char *domain = lp_workgroup(); if (!user_info || !server_info || !auth_context) { DEBUG(1,("check_ntdomain_security: Critical variables not present. Failing.\n")); @@ -494,7 +493,7 @@ static NTSTATUS check_ntdomain_security(const struct auth_context *auth_context, * password file. */ - if(is_netbios_alias_or_name(user_info->domain.str)) { + if(is_myname(user_info->domain.str)) { DEBUG(3,("check_ntdomain_security: Requested domain was for this machine.\n")); return NT_STATUS_LOGON_FAILURE; } @@ -528,7 +527,7 @@ static NTSTATUS check_ntdomain_security(const struct auth_context *auth_context, nt_status = domain_client_validate(mem_ctx, user_info, domain, (uchar *)auth_context->challenge.data, server_info, - password_server, global_myname, SEC_CHAN_WKSTA, trust_passwd, last_change_time); + password_server, global_myname(), SEC_CHAN_WKSTA, trust_passwd, last_change_time); return nt_status; } @@ -572,7 +571,7 @@ static NTSTATUS check_trustdomain_security(const struct auth_context *auth_conte * password file. */ - if(is_netbios_alias_or_name(user_info->domain.str)) { + if(is_myname(user_info->domain.str)) { DEBUG(3,("check_trustdomain_security: Requested domain was for this machine.\n")); return NT_STATUS_LOGON_FAILURE; } diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c index 7252193c9a2..9fa33dccf68 100644 --- a/source3/auth/auth_sam.c +++ b/source3/auth/auth_sam.c @@ -316,7 +316,7 @@ static NTSTATUS sam_account_ok(TALLOC_CTX *mem_ctx, if (*workstation_list) { BOOL invalid_ws = True; - char *s = workstation_list; + const char *s = workstation_list; fstring tok; @@ -454,7 +454,7 @@ static NTSTATUS check_samstrict_security(const struct auth_context *auth_context attempt to check the password locally, unless it is one of our aliases. */ - if (!is_netbios_alias_or_name(user_info->domain.str)) { + if (!is_myname(user_info->domain.str)) { return NT_STATUS_NO_SUCH_USER; } diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c index 0ed905e79c8..5144852d3b4 100644 --- a/source3/auth/auth_server.c +++ b/source3/auth/auth_server.c @@ -24,7 +24,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_AUTH -extern pstring global_myname; extern userdom_struct current_user_info; /**************************************************************************** @@ -36,7 +35,8 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx) struct cli_state *cli = NULL; fstring desthost; struct in_addr dest_ip; - char *p, *pserver; + const char *p; + char *pserver; BOOL connected_ok = False; if (!(cli = cli_initialise(cli))) @@ -85,7 +85,7 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx) return NULL; } - if (!attempt_netbios_session_request(cli, global_myname, + if (!attempt_netbios_session_request(cli, global_myname(), desthost, &dest_ip)) { release_server_mutex(); DEBUG(1,("password server fails session request\n")); @@ -231,7 +231,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context * password file. */ - if(is_netbios_alias_or_name(user_info->domain.str)) { + if(is_myname(user_info->domain.str)) { DEBUG(3,("check_smbserver_security: Requested domain was for this machine.\n")); return NT_STATUS_LOGON_FAILURE; } @@ -275,7 +275,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context if(baduser[0] == 0) { fstrcpy(baduser, INVALID_USER_PREFIX); - fstrcat(baduser, global_myname); + fstrcat(baduser, global_myname()); } /* diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index b14344ef50f..98b15f3fb62 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -26,7 +26,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_AUTH -extern pstring global_myname; extern DOM_SID global_sid_World; extern DOM_SID global_sid_Network; extern DOM_SID global_sid_Builtin_Guests; diff --git a/source3/client/client.c b/source3/client/client.c index 96b9837fef1..c8529b84f27 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -37,7 +37,6 @@ pstring cur_dir = "\\"; static pstring cd_path = ""; static pstring service; static pstring desthost; -extern pstring global_myname; static pstring password; static pstring username; static pstring workgroup; @@ -2177,7 +2176,7 @@ process a -c command string static int process_command_string(char *cmd) { pstring line; - char *ptr; + const char *ptr; int rc = 0; /* establish the connection if not already */ @@ -2297,7 +2296,7 @@ process commands on stdin ****************************************************************************/ static void process_stdin(void) { - char *ptr; + const char *ptr; while (1) { fstring tok; @@ -2362,7 +2361,7 @@ static struct cli_state *do_connect(const char *server, const char *share) zero_ip(&ip); - make_nmb_name(&calling, global_myname, 0x0); + make_nmb_name(&calling, global_myname(), 0x0); make_nmb_name(&called , server, name_type); again: @@ -2635,7 +2634,7 @@ static int do_message_op(void) fstring server_name; char name_type_hex[10]; - make_nmb_name(&calling, global_myname, 0x0); + make_nmb_name(&calling, global_myname(), 0x0); make_nmb_name(&called , desthost, name_type); safe_strcpy(server_name, desthost, sizeof(server_name)); @@ -2845,17 +2844,13 @@ static void remember_query_host(const char *arg, message = True; break; case 'i': - { - extern pstring global_scope; - pstrcpy(global_scope,optarg); - strupper(global_scope); - } + set_global_scope(optarg); break; case 'N': got_pass = True; break; case 'n': - pstrcpy(global_myname,optarg); + set_global_myname(optarg); break; case 'd': if (*optarg == 'A') @@ -3000,7 +2995,7 @@ static void remember_query_host(const char *arg, } } - get_myname((*global_myname)?NULL:global_myname); + init_names(); if(*new_name_resolve_order) lp_set_name_resolve_order(new_name_resolve_order); diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c index ff109635331..4c90db4114b 100644 --- a/source3/client/smbspool.c +++ b/source3/client/smbspool.c @@ -36,7 +36,7 @@ extern BOOL in_client; /* Boolean for client library */ */ static void list_devices(void); -static struct cli_state *smb_connect(char *, char *, char *, char *, char *); +static struct cli_state *smb_connect(const char *, const char *, const char *, const char *, const char *); static int smb_print(struct cli_state *, char *, FILE *); @@ -54,9 +54,9 @@ static int smb_print(struct cli_state *, char *, FILE *); *sep, /* Pointer to separator */ *username, /* Username */ *password, /* Password */ - *workgroup, /* Workgroup */ *server, /* Server name */ *printer; /* Printer name */ + const char *workgroup; /* Workgroup */ FILE *fp; /* File to print */ int status=0; /* Status of LPD job */ struct cli_state *cli; /* SMB interface */ @@ -265,11 +265,11 @@ list_devices(void) */ static struct cli_state * /* O - SMB connection */ -smb_connect(char *workgroup, /* I - Workgroup */ - char *server, /* I - Server */ - char *share, /* I - Printer */ - char *username, /* I - Username */ - char *password) /* I - Password */ +smb_connect(const char *workgroup, /* I - Workgroup */ + const char *server, /* I - Server */ + const char *share, /* I - Printer */ + const char *username, /* I - Username */ + const char *password) /* I - Password */ { struct cli_state *c; /* New connection */ pstring myname; /* Client name */ diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index f1f9fdafc12..0a2c1f3239d 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -840,7 +840,7 @@ convert a privilege string to a privilege array void convert_priv_from_text(PRIVILEGE_SET *se_priv, char *privilege) { pstring tok; - char *p = privilege; + const char *p = privilege; int i; LUID_ATTR set; diff --git a/source3/lib/access.c b/source3/lib/access.c index a39bc6df763..50efdcc5f04 100644 --- a/source3/lib/access.c +++ b/source3/lib/access.c @@ -15,17 +15,20 @@ #define ALLONES ((uint32)0xFFFFFFFF) /* masked_match - match address against netnumber/netmask */ -static int masked_match(char *tok, char *slash, char *s) +static BOOL masked_match(const char *tok, const char *slash, const char *s) { uint32 net; uint32 mask; uint32 addr; + fstring tok_cpy; if ((addr = interpret_addr(s)) == INADDR_NONE) return (False); - *slash = 0; - net = interpret_addr(tok); - *slash = '/'; + + fstrcpy(tok_cpy, tok); + tok_cpy[PTR_DIFF(slash,tok)] = '\0'; + net = interpret_addr(tok_cpy); + tok_cpy[PTR_DIFF(slash,tok)] = '/'; if (strlen(slash + 1) > 2) { mask = interpret_addr(slash + 1); @@ -41,11 +44,11 @@ static int masked_match(char *tok, char *slash, char *s) } /* string_match - match string against token */ -static int string_match(char *tok,char *s, char *invalid_char) +static BOOL string_match(const char *tok,const char *s, char *invalid_char) { size_t tok_len; size_t str_len; - char *cut; + const char *cut; *invalid_char = '\0'; @@ -73,7 +76,8 @@ static int string_match(char *tok,char *s, char *invalid_char) char *hostname = NULL; BOOL netgroup_ok = False; - if (!mydomain) yp_get_default_domain(&mydomain); + if (!mydomain) + yp_get_default_domain(&mydomain); if (!mydomain) { DEBUG(0,("Unable to get default yp domain.\n")); @@ -94,7 +98,8 @@ static int string_match(char *tok,char *s, char *invalid_char) SAFE_FREE(hostname); - if (netgroup_ok) return(True); + if (netgroup_ok) + return(True); #else DEBUG(0,("access: netgroup support is not configured\n")); return (False); @@ -122,20 +127,19 @@ static int string_match(char *tok,char *s, char *invalid_char) return (False); } - /* client_match - match host name and address against token */ -static int client_match(char *tok,char *item) +static BOOL client_match(const char *tok, const char *item) { - char **client = (char **)item; - int match; + const char **client = (const char **)item; + BOOL match; char invalid_char = '\0'; - /* - * Try to match the address first. If that fails, try to match the host - * name if available. - */ + /* + * Try to match the address first. If that fails, try to match the host + * name if available. + */ - if ((match = string_match(tok, client[1], &invalid_char)) == 0) { + if ((match = string_match(tok, client[1], &invalid_char)) == 0) { if(invalid_char) DEBUG(0,("client_match: address match failing due to invalid character '%c' found in \ token '%s' in an allow/deny hosts line.\n", invalid_char, tok )); @@ -148,50 +152,51 @@ token '%s' in an allow/deny hosts line.\n", invalid_char, tok )); token '%s' in an allow/deny hosts line.\n", invalid_char, tok )); } - return (match); + return (match); } /* list_match - match an item against a list of tokens with exceptions */ -static int list_match(char **list,char *item, int (*match_fn)(char *, char *)) +static BOOL list_match(const char **list,const char *item, + BOOL (*match_fn)(const char *, const char *)) { - int match = False; - - if (!list) return False; - - /* - * Process tokens one at a time. We have exhausted all possible matches - * when we reach an "EXCEPT" token or the end of the list. If we do find - * a match, look for an "EXCEPT" list and recurse to determine whether - * the match is affected by any exceptions. - */ - - for (; *list ; list++) { - if (strcasecmp(*list, "EXCEPT") == 0) /* EXCEPT: give up */ - break; - if ((match = (*match_fn) (*list, item))) /* True or FAIL */ - break; - } - /* Process exceptions to True or FAIL matches. */ - - if (match != False) { - while (*list && strcasecmp(*list, "EXCEPT")) - list++; - - for (; *list; list++) { - if ((*match_fn) (*list, item)) /* Exception Found */ - return False; + BOOL match = False; + + if (!list) + return False; + + /* + * Process tokens one at a time. We have exhausted all possible matches + * when we reach an "EXCEPT" token or the end of the list. If we do find + * a match, look for an "EXCEPT" list and recurse to determine whether + * the match is affected by any exceptions. + */ + + for (; *list ; list++) { + if (strcasecmp(*list, "EXCEPT") == 0) /* EXCEPT: give up */ + break; + if ((match = (*match_fn) (*list, item))) /* True or FAIL */ + break; } - } + /* Process exceptions to True or FAIL matches. */ - return (match); -} + if (match != False) { + while (*list && strcasecmp(*list, "EXCEPT")) + list++; + for (; *list; list++) { + if ((*match_fn) (*list, item)) /* Exception Found */ + return False; + } + } + + return (match); +} /* return true if access should be allowed */ -static BOOL allow_access_internal(char **deny_list,char **allow_list, - char *cname,char *caddr) +static BOOL allow_access_internal(const char **deny_list,const char **allow_list, + const char *cname, const char *caddr) { - char *client[2]; + const char *client[2]; client[0] = cname; client[1] = caddr; @@ -203,9 +208,9 @@ static BOOL allow_access_internal(char **deny_list,char **allow_list, * Patch from Steve Langasek vorlon@netexpress.net. */ if (deny_list && - list_match(deny_list,(char *)client,client_match) && + list_match(deny_list,(const char *)client,client_match) && (!allow_list || - !list_match(allow_list,(char *)client, client_match))) { + !list_match(allow_list,(const char *)client, client_match))) { return False; } return True; @@ -220,32 +225,31 @@ static BOOL allow_access_internal(char **deny_list,char **allow_list, /* if there is an allow list but no deny list then allow only hosts on the allow list */ if (!deny_list || *deny_list == 0) - return(list_match(allow_list,(char *)client,client_match)); + return(list_match(allow_list,(const char *)client,client_match)); /* if theres a deny list but no allow list then allow all hosts not on the deny list */ if (!allow_list || *allow_list == 0) - return(!list_match(deny_list,(char *)client,client_match)); + return(!list_match(deny_list,(const char *)client,client_match)); /* if there are both types of list then allow all hosts on the allow list */ - if (list_match(allow_list,(char *)client,client_match)) + if (list_match(allow_list,(const char *)client,client_match)) return (True); /* if there are both types of list and it's not on the allow then allow it if its not on the deny */ - if (list_match(deny_list,(char *)client,client_match)) + if (list_match(deny_list,(const char *)client,client_match)) return (False); return (True); } /* return true if access should be allowed */ -BOOL allow_access(char **deny_list,char **allow_list, +BOOL allow_access(const char **deny_list, const char **allow_list, const char *cname, const char *caddr) { BOOL ret; - char *nc_cname = smb_xstrdup(cname); char *nc_caddr = smb_xstrdup(caddr); @@ -258,31 +262,29 @@ BOOL allow_access(char **deny_list,char **allow_list, /* return true if the char* contains ip addrs only. Used to avoid gethostbyaddr() calls */ -static BOOL only_ipaddrs_in_list(char** list) + +static BOOL only_ipaddrs_in_list(const char** list) { - BOOL only_ip = True; + BOOL only_ip = True; - if (!list) return True; + if (!list) + return True; - for (; *list ; list++) - { + for (; *list ; list++) { /* factor out the special strings */ if (!strcasecmp(*list, "ALL") || !strcasecmp(*list, "FAIL") || - !strcasecmp(*list, "EXCEPT")) - { + !strcasecmp(*list, "EXCEPT")) { continue; } - if (!is_ipaddress(*list)) - { + if (!is_ipaddress(*list)) { char *p; /* * if we failed, make sure that it was not because the token * was a network/netmask pair. Only network/netmask pairs * have a '/' in them */ - if ((p=strchr_m(*list, '/')) == NULL) - { + if ((p=strchr_m(*list, '/')) == NULL) { only_ip = False; DEBUG(3,("only_ipaddrs_in_list: list has non-ip address (%s)\n", *list)); break; @@ -294,40 +296,31 @@ static BOOL only_ipaddrs_in_list(char** list) } /* return true if access should be allowed to a service for a socket */ -BOOL check_access(int sock, char **allow_list, char **deny_list) +BOOL check_access(int sock, const char **allow_list, const char **deny_list) { BOOL ret = False; BOOL only_ip = False; - if ((!deny_list || *deny_list==0) && (!allow_list || *allow_list==0)) - { + if ((!deny_list || *deny_list==0) && (!allow_list || *allow_list==0)) ret = True; - } - if (!ret) - { + if (!ret) { /* bypass gethostbyaddr() calls if the lists only contain IP addrs */ - if (only_ipaddrs_in_list(allow_list) && only_ipaddrs_in_list(deny_list)) - { + if (only_ipaddrs_in_list(allow_list) && only_ipaddrs_in_list(deny_list)) { only_ip = True; DEBUG (3, ("check_access: no hostnames in host allow/deny list.\n")); ret = allow_access(deny_list,allow_list, "", get_socket_addr(sock)); - } - else - { + } else { DEBUG (3, ("check_access: hostnames in host allow/deny list.\n")); ret = allow_access(deny_list,allow_list, get_socket_name(sock,True), get_socket_addr(sock)); } - if (ret) - { + if (ret) { DEBUG(2,("Allowed connection from %s (%s)\n", only_ip ? "" : get_socket_name(sock,True), get_socket_addr(sock))); - } - else - { + } else { DEBUG(0,("Denied connection from %s (%s)\n", only_ip ? "" : get_socket_name(sock,True), get_socket_addr(sock))); diff --git a/source3/lib/interface.c b/source3/lib/interface.c index 0d751a9c7cf..4d8010e31bc 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -94,7 +94,7 @@ This handles the following different forms: 4) ip/mask 5) bcast/mask ****************************************************************************/ -static void interpret_interface(char *token) +static void interpret_interface(const char *token) { struct in_addr ip, nmask; char *p; @@ -162,7 +162,7 @@ load the list of network interfaces ****************************************************************************/ void load_interfaces(void) { - char **ptr; + const char **ptr; int i; struct iface_struct ifaces[MAX_INTERFACES]; diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index aaec4487625..77c44f127a0 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -33,7 +33,6 @@ extern pstring user_socket_options; extern BOOL AllowDebugChange; -extern pstring global_myname; static void popt_common_callback(poptContext con, enum poptCallbackReason reason, @@ -84,8 +83,7 @@ static void popt_common_callback(poptContext con, case 'n': if (arg) { - pstrcpy(global_myname,arg); - strupper(global_myname); + set_global_myname(arg); } break; diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index 2550d00d14c..23cfce6c692 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -25,7 +25,6 @@ fstring local_machine=""; fstring remote_arch="UNKNOWN"; userdom_struct current_user_info; fstring remote_proto="UNKNOWN"; -extern pstring global_myname; static fstring remote_machine=""; @@ -230,7 +229,7 @@ static const char *automount_server(const char *user_name) if (local_machine_name && *local_machine_name) pstrcpy(server_name, local_machine_name); else - pstrcpy(server_name, global_myname); + pstrcpy(server_name, global_myname()); #if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT)) @@ -300,7 +299,7 @@ void standard_sub_basic(const char *smb_name, char *str,size_t len) else { pstring temp_name; - pstrcpy(temp_name, global_myname); + pstrcpy(temp_name, global_myname()); strlower(temp_name); string_sub(p,"%L", temp_name,l); } @@ -458,7 +457,7 @@ char *alloc_sub_basic(const char *smb_name, const char *str) if (local_machine_name && *local_machine_name) t = realloc_string_sub(t, "%L", local_machine_name); else - t = realloc_string_sub(t, "%L", global_myname); + t = realloc_string_sub(t, "%L", global_myname()); break; case 'M' : t = realloc_string_sub(t, "%M", client_name()); diff --git a/source3/lib/username.c b/source3/lib/username.c index ef11542ab19..b1c9ca0f08a 100644 --- a/source3/lib/username.c +++ b/source3/lib/username.c @@ -169,7 +169,7 @@ BOOL map_username(char *user) return False; } - if (strchr_m(dosname,'*') || user_in_list(user, dosuserlist)) { + if (strchr_m(dosname,'*') || user_in_list(user, (const char **)dosuserlist)) { DEBUG(3,("Mapped user %s to %s\n",user,unixname)); mapped_user = True; fstrcpy(last_from,user); @@ -451,7 +451,7 @@ BOOL user_in_group_list(const char *user, const char *gname) and netgroup lists. ****************************************************************************/ -BOOL user_in_list(const char *user,char **list) +BOOL user_in_list(const char *user,const char **list) { if (!list || !*list) return False; diff --git a/source3/lib/util.c b/source3/lib/util.c index 51b92568b4d..2dbd732cd8e 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2,7 +2,7 @@ Unix SMB/CIFS implementation. Samba utility functions Copyright (C) Andrew Tridgell 1992-1998 - Copyright (C) Jeremy Allison 2001 + Copyright (C) Jeremy Allison 2001-2002 Copyright (C) Simo Sorce 2001 This program is free software; you can redistribute it and/or modify @@ -78,22 +78,212 @@ BOOL case_mangle; static enum remote_arch_types ra_type = RA_UNKNOWN; pstring user_socket_options=DEFAULT_SOCKET_OPTIONS; -pstring global_myname = ""; -fstring global_myworkgroup = ""; -char **my_netbios_names; +/*********************************************************************** + Definitions for all names. +***********************************************************************/ +static char *smb_myname; +static char *smb_myworkgroup; +static char *smb_scope; +static int smb_num_netbios_names; +static char **smb_my_netbios_names; + +/*********************************************************************** + Allocate and set myname. Ensure upper case. +***********************************************************************/ + +BOOL set_global_myname(const char *myname) +{ + SAFE_FREE(smb_myname); + smb_myname = strdup(myname); + if (!smb_myname) + return False; + strupper(smb_myname); + return True; +} + +const char *global_myname(void) +{ + return smb_myname; +} + +/*********************************************************************** + Allocate and set myworkgroup. Ensure upper case. +***********************************************************************/ + +BOOL set_global_myworkgroup(const char *myworkgroup) +{ + SAFE_FREE(smb_myworkgroup); + smb_myworkgroup = strdup(myworkgroup); + if (!smb_myworkgroup) + return False; + strupper(smb_myworkgroup); + return True; +} + +const char *lp_workgroup(void) +{ + return smb_myworkgroup; +} + +/*********************************************************************** + Allocate and set scope. Ensure upper case. +***********************************************************************/ + +BOOL set_global_scope(const char *scope) +{ + SAFE_FREE(smb_scope); + smb_scope = strdup(scope); + if (!smb_scope) + return False; + strupper(smb_scope); + return True; +} + +const char *global_scope(void) +{ + return smb_scope; +} + +static void free_netbios_names_array(void) +{ + int i; + + for (i = 0; i < smb_num_netbios_names; i++) + SAFE_FREE(smb_my_netbios_names[i]); + + SAFE_FREE(smb_my_netbios_names); + smb_num_netbios_names = 0; +} + +static BOOL allocate_my_netbios_names_array(size_t number) +{ + free_netbios_names_array(); + + smb_num_netbios_names = number + 1; + smb_my_netbios_names = (char **)malloc( sizeof(char *) * smb_num_netbios_names ); + + if (!smb_my_netbios_names) + return False; + + memset(smb_my_netbios_names, '\0', sizeof(char *) * smb_num_netbios_names); + return True; +} + +static BOOL set_my_netbios_names(const char *name, int i) +{ + SAFE_FREE(smb_my_netbios_names[i]); + + smb_my_netbios_names[i] = strdup(name); + if (!smb_my_netbios_names[i]) + return False; + strupper(smb_my_netbios_names[i]); + return True; +} + +const char *my_netbios_names(int i) +{ + return smb_my_netbios_names[i]; +} + +BOOL set_netbios_aliases(const char **str_array) +{ + size_t namecount; + + /* Work out the max number of netbios aliases that we have */ + for( namecount=0; str_array && (str_array[namecount] != NULL); namecount++ ) + ; + + if ( global_myname() && *global_myname()) + namecount++; + + /* Allocate space for the netbios aliases */ + if (!allocate_my_netbios_names_array(namecount)) + return False; + + /* Use the global_myname string first */ + namecount=0; + if ( global_myname() && *global_myname()) { + set_my_netbios_names( global_myname(), namecount ); + namecount++; + } + + if (str_array) { + size_t i; + for ( i = 0; str_array[i] != NULL; i++) { + size_t n; + BOOL duplicate = False; + + /* Look for duplicates */ + for( n=0; nst_mode)) || (S_ISFIFO(sbuf->st_mode))); } @@ -193,12 +381,12 @@ BOOL file_exist(const char *fname,SMB_STRUCT_STAT *sbuf) time_t file_modtime(const char *fname) { - SMB_STRUCT_STAT st; + SMB_STRUCT_STAT st; - if (sys_stat(fname,&st) != 0) - return(0); + if (sys_stat(fname,&st) != 0) + return(0); - return(st.st_mtime); + return(st.st_mtime); } /******************************************************************* @@ -207,60 +395,65 @@ time_t file_modtime(const char *fname) BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st) { - SMB_STRUCT_STAT st2; - BOOL ret; + SMB_STRUCT_STAT st2; + BOOL ret; - if (!st) st = &st2; + if (!st) + st = &st2; - if (sys_stat(dname,st) != 0) - return(False); + if (sys_stat(dname,st) != 0) + return(False); - ret = S_ISDIR(st->st_mode); - if(!ret) - errno = ENOTDIR; - return ret; + ret = S_ISDIR(st->st_mode); + if(!ret) + errno = ENOTDIR; + return ret; } /******************************************************************* -returns the size in bytes of the named file + Returns the size in bytes of the named file. ********************************************************************/ + SMB_OFF_T get_file_size(char *file_name) { - SMB_STRUCT_STAT buf; - buf.st_size = 0; - if(sys_stat(file_name,&buf) != 0) - return (SMB_OFF_T)-1; - return(buf.st_size); + SMB_STRUCT_STAT buf; + buf.st_size = 0; + if(sys_stat(file_name,&buf) != 0) + return (SMB_OFF_T)-1; + return(buf.st_size); } /******************************************************************* -return a string representing an attribute for a file + Return a string representing an attribute for a file. ********************************************************************/ + char *attrib_string(uint16 mode) { - static fstring attrstr; + static fstring attrstr; - attrstr[0] = 0; + attrstr[0] = 0; - if (mode & aVOLID) fstrcat(attrstr,"V"); - if (mode & aDIR) fstrcat(attrstr,"D"); - if (mode & aARCH) fstrcat(attrstr,"A"); - if (mode & aHIDDEN) fstrcat(attrstr,"H"); - if (mode & aSYSTEM) fstrcat(attrstr,"S"); - if (mode & aRONLY) fstrcat(attrstr,"R"); + if (mode & aVOLID) fstrcat(attrstr,"V"); + if (mode & aDIR) fstrcat(attrstr,"D"); + if (mode & aARCH) fstrcat(attrstr,"A"); + if (mode & aHIDDEN) fstrcat(attrstr,"H"); + if (mode & aSYSTEM) fstrcat(attrstr,"S"); + if (mode & aRONLY) fstrcat(attrstr,"R"); - return(attrstr); + return(attrstr); } /******************************************************************* - show a smb message structure + Show a smb message structure. ********************************************************************/ + void show_msg(char *buf) { int i; int bcc=0; - if (!DEBUGLVL(5)) return; + if (!DEBUGLVL(5)) + return; DEBUG(5,("size=%d\nsmb_com=0x%x\nsmb_rcls=%d\nsmb_reh=%d\nsmb_err=%d\nsmb_flg=%d\nsmb_flg2=%d\n", smb_len(buf), @@ -285,29 +478,33 @@ void show_msg(char *buf) DEBUGADD(5,("smb_bcc=%d\n",bcc)); - if (DEBUGLEVEL < 10) return; + if (DEBUGLEVEL < 10) + return; - if (DEBUGLEVEL < 50) bcc = MIN(bcc, 512); + if (DEBUGLEVEL < 50) + bcc = MIN(bcc, 512); dump_data(10, smb_buf(buf), bcc); } /******************************************************************* - set the length and marker of an smb packet + Set the length and marker of an smb packet. ********************************************************************/ + void smb_setlen(char *buf,int len) { - _smb_setlen(buf,len); + _smb_setlen(buf,len); - SCVAL(buf,4,0xFF); - SCVAL(buf,5,'S'); - SCVAL(buf,6,'M'); - SCVAL(buf,7,'B'); + SCVAL(buf,4,0xFF); + SCVAL(buf,5,'S'); + SCVAL(buf,6,'M'); + SCVAL(buf,7,'B'); } /******************************************************************* - setup the word count and byte count for a smb message + Setup the word count and byte count for a smb message. ********************************************************************/ + int set_message(char *buf,int num_words,int num_bytes,BOOL zero) { if (zero) @@ -319,8 +516,9 @@ int set_message(char *buf,int num_words,int num_bytes,BOOL zero) } /******************************************************************* - setup only the byte count for a smb message + Setup only the byte count for a smb message. ********************************************************************/ + int set_message_bcc(char *buf,int num_bytes) { int num_words = CVAL(buf,smb_wct); @@ -330,111 +528,117 @@ int set_message_bcc(char *buf,int num_bytes) } /******************************************************************* - setup only the byte count for a smb message, using the end of the - message as a marker + Setup only the byte count for a smb message, using the end of the + message as a marker. ********************************************************************/ + int set_message_end(void *outbuf,void *end_ptr) { return set_message_bcc((char *)outbuf,PTR_DIFF(end_ptr,smb_buf((char *)outbuf))); } /******************************************************************* -reduce a file name, removing .. elements. + Reduce a file name, removing .. elements. ********************************************************************/ + void dos_clean_name(char *s) { - char *p=NULL; + char *p=NULL; - DEBUG(3,("dos_clean_name [%s]\n",s)); + DEBUG(3,("dos_clean_name [%s]\n",s)); - /* remove any double slashes */ - all_string_sub(s, "\\\\", "\\", 0); + /* remove any double slashes */ + all_string_sub(s, "\\\\", "\\", 0); - while ((p = strstr(s,"\\..\\")) != NULL) - { - pstring s1; + while ((p = strstr(s,"\\..\\")) != NULL) { + pstring s1; - *p = 0; - pstrcpy(s1,p+3); + *p = 0; + pstrcpy(s1,p+3); - if ((p=strrchr_m(s,'\\')) != NULL) - *p = 0; - else - *s = 0; - pstrcat(s,s1); - } + if ((p=strrchr_m(s,'\\')) != NULL) + *p = 0; + else + *s = 0; + pstrcat(s,s1); + } - trim_string(s,NULL,"\\.."); + trim_string(s,NULL,"\\.."); - all_string_sub(s, "\\.\\", "\\", 0); + all_string_sub(s, "\\.\\", "\\", 0); } /******************************************************************* -reduce a file name, removing .. elements. + Reduce a file name, removing .. elements. ********************************************************************/ + void unix_clean_name(char *s) { - char *p=NULL; + char *p=NULL; - DEBUG(3,("unix_clean_name [%s]\n",s)); + DEBUG(3,("unix_clean_name [%s]\n",s)); - /* remove any double slashes */ - all_string_sub(s, "//","/", 0); + /* remove any double slashes */ + all_string_sub(s, "//","/", 0); - /* Remove leading ./ characters */ - if(strncmp(s, "./", 2) == 0) { - trim_string(s, "./", NULL); - if(*s == 0) - pstrcpy(s,"./"); - } + /* Remove leading ./ characters */ + if(strncmp(s, "./", 2) == 0) { + trim_string(s, "./", NULL); + if(*s == 0) + pstrcpy(s,"./"); + } - while ((p = strstr(s,"/../")) != NULL) - { - pstring s1; + while ((p = strstr(s,"/../")) != NULL) { + pstring s1; - *p = 0; - pstrcpy(s1,p+3); + *p = 0; + pstrcpy(s1,p+3); - if ((p=strrchr_m(s,'/')) != NULL) - *p = 0; - else - *s = 0; - pstrcat(s,s1); - } + if ((p=strrchr_m(s,'/')) != NULL) + *p = 0; + else + *s = 0; + pstrcat(s,s1); + } - trim_string(s,NULL,"/.."); + trim_string(s,NULL,"/.."); } /******************************************************************* -convert '\' to '/' -reduce a file name, removing or reducing /../ , /./ , // elements. -remove also any trailing . and / -return a new allocated string. + Convert '\' to '/'. + Reduce a file name, removing or reducing /../ , /./ , // elements. + Remove also any trailing . and / + Return a new allocated string. ********************************************************************/ + smb_ucs2_t *unix_clean_path(const smb_ucs2_t *s) { smb_ucs2_t *ns; smb_ucs2_t *p, *r, *t; DEBUG(3, ("unix_clean_path\n")); /* [%unicode]\n")); */ - if(!s) return NULL; + if(!s) + return NULL; /* convert '\' to '/' */ ns = strdup_w(s); - if (!ns) return NULL; + if (!ns) + return NULL; unix_format_w(ns); /* remove all double slashes */ p = ns; ns = all_string_sub_wa(p, "//", "/"); SAFE_FREE(p); - if (!ns) return NULL; + if (!ns) + return NULL; /* remove any /./ */ p = ns; ns = all_string_sub_wa(p, "/./", "/"); SAFE_FREE(p); - if (!ns) return NULL; + if (!ns) + return NULL; /* reduce any /../ */ t = ns; @@ -443,9 +647,12 @@ smb_ucs2_t *unix_clean_path(const smb_ucs2_t *s) if (*t == UCS2_CHAR('/') || *t == 0) { *r = 0; p = strrchr_w(ns, UCS2_CHAR('/')); - if (!p) p = ns; - if (*t == 0) *p = 0; - else memmove(p, t, (strlen_w(t) + 1) * sizeof(smb_ucs2_t)); + if (!p) + p = ns; + if (*t == 0) + *p = 0; + else + memmove(p, t, (strlen_w(t) + 1) * sizeof(smb_ucs2_t)); t = p; } } @@ -460,82 +667,82 @@ smb_ucs2_t *unix_clean_path(const smb_ucs2_t *s) } /**************************************************************************** - make a dir struct + Make a dir struct. ****************************************************************************/ + void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,time_t date) { - char *p; - pstring mask2; + char *p; + pstring mask2; - pstrcpy(mask2,mask); + pstrcpy(mask2,mask); - if ((mode & aDIR) != 0) - size = 0; + if ((mode & aDIR) != 0) + size = 0; - memset(buf+1,' ',11); - if ((p = strchr_m(mask2,'.')) != NULL) - { - *p = 0; - push_ascii(buf+1,mask2,8, 0); - push_ascii(buf+9,p+1,3, 0); - *p = '.'; - } - else - push_ascii(buf+1,mask2,11, 0); + memset(buf+1,' ',11); + if ((p = strchr_m(mask2,'.')) != NULL) { + *p = 0; + push_ascii(buf+1,mask2,8, 0); + push_ascii(buf+9,p+1,3, 0); + *p = '.'; + } else + push_ascii(buf+1,mask2,11, 0); - memset(buf+21,'\0',DIR_STRUCT_SIZE-21); - SCVAL(buf,21,mode); - put_dos_date(buf,22,date); - SSVAL(buf,26,size & 0xFFFF); - SSVAL(buf,28,(size >> 16)&0xFFFF); - push_ascii(buf+30,fname,12, 0); - if (!case_sensitive) - strupper(buf+30); - DEBUG(8,("put name [%s] from [%s] into dir struct\n",buf+30, fname)); + memset(buf+21,'\0',DIR_STRUCT_SIZE-21); + SCVAL(buf,21,mode); + put_dos_date(buf,22,date); + SSVAL(buf,26,size & 0xFFFF); + SSVAL(buf,28,(size >> 16)&0xFFFF); + push_ascii(buf+30,fname,12, case_sensitive ? 0 : STR_UPPER); + DEBUG(8,("put name [%s] from [%s] into dir struct\n",buf+30, fname)); } - /******************************************************************* -close the low 3 fd's and open dev/null in their place + Close the low 3 fd's and open dev/null in their place. ********************************************************************/ + void close_low_fds(BOOL stderr_too) { - int fd; - int i; - close(0); close(1); - - if (stderr_too) { - close(2); - } - - /* try and use up these file descriptors, so silly - library routines writing to stdout etc won't cause havoc */ - for (i=0;i<3;i++) { - if (i == 2 && !stderr_too) - continue; - - fd = sys_open("/dev/null",O_RDWR,0); - if (fd < 0) fd = sys_open("/dev/null",O_WRONLY,0); - if (fd < 0) { - DEBUG(0,("Can't open /dev/null\n")); - return; - } - if (fd != i) { - DEBUG(0,("Didn't get file descriptor %d\n",i)); - return; - } - } + int fd; + int i; + + close(0); + close(1); + + if (stderr_too) + close(2); + + /* try and use up these file descriptors, so silly + library routines writing to stdout etc won't cause havoc */ + for (i=0;i<3;i++) { + if (i == 2 && !stderr_too) + continue; + + fd = sys_open("/dev/null",O_RDWR,0); + if (fd < 0) + fd = sys_open("/dev/null",O_WRONLY,0); + if (fd < 0) { + DEBUG(0,("Can't open /dev/null\n")); + return; + } + if (fd != i) { + DEBUG(0,("Didn't get file descriptor %d\n",i)); + return; + } + } } /**************************************************************************** -Set a fd into blocking/nonblocking mode. Uses POSIX O_NONBLOCK if available, -else -if SYSV use O_NDELAY -if BSD use FNDELAY + Set a fd into blocking/nonblocking mode. Uses POSIX O_NONBLOCK if available, + else + if SYSV use O_NDELAY + if BSD use FNDELAY ****************************************************************************/ + int set_blocking(int fd, BOOL set) { - int val; + int val; #ifdef O_NONBLOCK #define FLAG_TO_SET O_NONBLOCK #else @@ -546,13 +753,13 @@ int set_blocking(int fd, BOOL set) #endif #endif - if((val = sys_fcntl_long(fd, F_GETFL, 0)) == -1) - return -1; - if(set) /* Turn blocking on - ie. clear nonblock flag */ - val &= ~FLAG_TO_SET; - else - val |= FLAG_TO_SET; - return sys_fcntl_long( fd, F_SETFL, val); + if((val = sys_fcntl_long(fd, F_GETFL, 0)) == -1) + return -1; + if(set) /* Turn blocking on - ie. clear nonblock flag */ + val &= ~FLAG_TO_SET; + else + val |= FLAG_TO_SET; + return sys_fcntl_long( fd, F_SETFL, val); #undef FLAG_TO_SET } @@ -660,9 +867,8 @@ void msleep(unsigned int t) void become_daemon(void) { - if (sys_fork()) { + if (sys_fork()) _exit(0); - } /* detach from the terminal */ #ifdef HAVE_SETSID @@ -682,22 +888,22 @@ void become_daemon(void) attach it to the logfile */ } - /**************************************************************************** - Put up a yes/no prompt + Put up a yes/no prompt. ****************************************************************************/ + BOOL yesno(char *p) { - pstring ans; - printf("%s",p); + pstring ans; + printf("%s",p); - if (!fgets(ans,sizeof(ans)-1,stdin)) - return(False); + if (!fgets(ans,sizeof(ans)-1,stdin)) + return(False); - if (*ans == 'y' || *ans == 'Y') - return(True); + if (*ans == 'y' || *ans == 'Y') + return(True); - return(False); + return(False); } /**************************************************************************** @@ -706,29 +912,29 @@ BOOL yesno(char *p) void *Realloc(void *p,size_t size) { - void *ret=NULL; + void *ret=NULL; - if (size == 0) { - SAFE_FREE(p); - DEBUG(5,("Realloc asked for 0 bytes\n")); - return NULL; - } + if (size == 0) { + SAFE_FREE(p); + DEBUG(5,("Realloc asked for 0 bytes\n")); + return NULL; + } - if (!p) - ret = (void *)malloc(size); - else - ret = (void *)realloc(p,size); + if (!p) + ret = (void *)malloc(size); + else + ret = (void *)realloc(p,size); - if (!ret) - DEBUG(0,("Memory allocation error: failed to expand to %d bytes\n",(int)size)); + if (!ret) + DEBUG(0,("Memory allocation error: failed to expand to %d bytes\n",(int)size)); - return(ret); + return(ret); } /**************************************************************************** Free memory, checks for NULL. -use directly SAFE_FREE() -exist only because we need to pass a function pointer somewhere --SSS + Use directly SAFE_FREE() + Exists only because we need to pass a function pointer somewhere --SSS ****************************************************************************/ void safe_free(void *p) @@ -774,22 +980,22 @@ BOOL get_myname(char *my_name) int interpret_protocol(char *str,int def) { - if (strequal(str,"NT1")) - return(PROTOCOL_NT1); - if (strequal(str,"LANMAN2")) - return(PROTOCOL_LANMAN2); - if (strequal(str,"LANMAN1")) - return(PROTOCOL_LANMAN1); - if (strequal(str,"CORE")) - return(PROTOCOL_CORE); - if (strequal(str,"COREPLUS")) - return(PROTOCOL_COREPLUS); - if (strequal(str,"CORE+")) - return(PROTOCOL_COREPLUS); + if (strequal(str,"NT1")) + return(PROTOCOL_NT1); + if (strequal(str,"LANMAN2")) + return(PROTOCOL_LANMAN2); + if (strequal(str,"LANMAN1")) + return(PROTOCOL_LANMAN1); + if (strequal(str,"CORE")) + return(PROTOCOL_CORE); + if (strequal(str,"COREPLUS")) + return(PROTOCOL_COREPLUS); + if (strequal(str,"CORE+")) + return(PROTOCOL_COREPLUS); - DEBUG(0,("Unrecognised protocol level %s\n",str)); + DEBUG(0,("Unrecognised protocol level %s\n",str)); - return(def); + return(def); } /**************************************************************************** @@ -798,77 +1004,83 @@ int interpret_protocol(char *str,int def) BOOL is_ipaddress(const char *str) { - BOOL pure_address = True; - int i; + BOOL pure_address = True; + int i; - for (i=0; pure_address && str[i]; i++) - if (!(isdigit((int)str[i]) || str[i] == '.')) - pure_address = False; + for (i=0; pure_address && str[i]; i++) + if (!(isdigit((int)str[i]) || str[i] == '.')) + pure_address = False; - /* Check that a pure number is not misinterpreted as an IP */ - pure_address = pure_address && (strchr_m(str, '.') != NULL); + /* Check that a pure number is not misinterpreted as an IP */ + pure_address = pure_address && (strchr_m(str, '.') != NULL); - return pure_address; + return pure_address; } /**************************************************************************** -interpret an internet address or name into an IP address in 4 byte form + Interpret an internet address or name into an IP address in 4 byte form. ****************************************************************************/ uint32 interpret_addr(const char *str) { - struct hostent *hp; - uint32 res; + struct hostent *hp; + uint32 res; - if (strcmp(str,"0.0.0.0") == 0) return(0); - if (strcmp(str,"255.255.255.255") == 0) return(0xFFFFFFFF); + if (strcmp(str,"0.0.0.0") == 0) + return(0); + if (strcmp(str,"255.255.255.255") == 0) + return(0xFFFFFFFF); /* if it's in the form of an IP address then get the lib to interpret it */ - if (is_ipaddress(str)) { - res = inet_addr(str); - } else { - /* otherwise assume it's a network name of some sort and use - sys_gethostbyname */ - if ((hp = sys_gethostbyname(str)) == 0) { - DEBUG(3,("sys_gethostbyname: Unknown host. %s\n",str)); - return 0; - } - if(hp->h_addr == NULL) { - DEBUG(3,("sys_gethostbyname: host address is invalid for host %s\n",str)); - return 0; - } - putip((char *)&res,(char *)hp->h_addr); - } + if (is_ipaddress(str)) { + res = inet_addr(str); + } else { + /* otherwise assume it's a network name of some sort and use + sys_gethostbyname */ + if ((hp = sys_gethostbyname(str)) == 0) { + DEBUG(3,("sys_gethostbyname: Unknown host. %s\n",str)); + return 0; + } + + if(hp->h_addr == NULL) { + DEBUG(3,("sys_gethostbyname: host address is invalid for host %s\n",str)); + return 0; + } + putip((char *)&res,(char *)hp->h_addr); + } - if (res == (uint32)-1) return(0); + if (res == (uint32)-1) + return(0); - return(res); + return(res); } /******************************************************************* - a convenient addition to interpret_addr() - ******************************************************************/ + A convenient addition to interpret_addr(). +******************************************************************/ + struct in_addr *interpret_addr2(const char *str) { - static struct in_addr ret; - uint32 a = interpret_addr(str); - ret.s_addr = a; - return(&ret); + static struct in_addr ret; + uint32 a = interpret_addr(str); + ret.s_addr = a; + return(&ret); } /******************************************************************* - Check if an IP is the 0.0.0.0 - ******************************************************************/ + Check if an IP is the 0.0.0.0. +******************************************************************/ + BOOL is_zero_ip(struct in_addr ip) { - uint32 a; - putip((char *)&a,(char *)&ip); - return(a == 0); + uint32 a; + putip((char *)&a,(char *)&ip); + return(a == 0); } /******************************************************************* - Set an IP to 0.0.0.0 - ******************************************************************/ + Set an IP to 0.0.0.0. +******************************************************************/ void zero_ip(struct in_addr *ip) { @@ -891,20 +1103,19 @@ void zero_ip(struct in_addr *ip) static void strip_mount_options( pstring *str) { - if (**str == '-') - { - char *p = *str; - while(*p && !isspace(*p)) - p++; - while(*p && isspace(*p)) - p++; - if(*p) { - pstring tmp_str; - - pstrcpy(tmp_str, p); - pstrcpy(*str, tmp_str); - } - } + if (**str == '-') { + char *p = *str; + while(*p && !isspace(*p)) + p++; + while(*p && isspace(*p)) + p++; + if(*p) { + pstring tmp_str; + + pstrcpy(tmp_str, p); + pstrcpy(*str, tmp_str); + } + } } /******************************************************************* @@ -917,127 +1128,118 @@ static void strip_mount_options( pstring *str) #ifdef WITH_NISPLUS_HOME char *automount_lookup(const char *user_name) { - static fstring last_key = ""; - static pstring last_value = ""; + static fstring last_key = ""; + static pstring last_value = ""; - char *nis_map = (char *)lp_nis_home_map_name(); + char *nis_map = (char *)lp_nis_home_map_name(); - char buffer[NIS_MAXATTRVAL + 1]; - nis_result *result; - nis_object *object; - entry_obj *entry; + char buffer[NIS_MAXATTRVAL + 1]; + nis_result *result; + nis_object *object; + entry_obj *entry; - if (strcmp(user_name, last_key)) - { - slprintf(buffer, sizeof(buffer)-1, "[key=%s],%s", user_name, nis_map); - DEBUG(5, ("NIS+ querystring: %s\n", buffer)); + if (strcmp(user_name, last_key)) { + slprintf(buffer, sizeof(buffer)-1, "[key=%s],%s", user_name, nis_map); + DEBUG(5, ("NIS+ querystring: %s\n", buffer)); - if (result = nis_list(buffer, FOLLOW_PATH|EXPAND_NAME|HARD_LOOKUP, NULL, NULL)) - { - if (result->status != NIS_SUCCESS) - { - DEBUG(3, ("NIS+ query failed: %s\n", nis_sperrno(result->status))); - fstrcpy(last_key, ""); pstrcpy(last_value, ""); - } - else - { - object = result->objects.objects_val; - if (object->zo_data.zo_type == ENTRY_OBJ) - { - entry = &object->zo_data.objdata_u.en_data; - DEBUG(5, ("NIS+ entry type: %s\n", entry->en_type)); - DEBUG(3, ("NIS+ result: %s\n", entry->en_cols.en_cols_val[1].ec_value.ec_value_val)); + if (result = nis_list(buffer, FOLLOW_PATH|EXPAND_NAME|HARD_LOOKUP, NULL, NULL)) { + if (result->status != NIS_SUCCESS) { + DEBUG(3, ("NIS+ query failed: %s\n", nis_sperrno(result->status))); + fstrcpy(last_key, ""); pstrcpy(last_value, ""); + } else { + object = result->objects.objects_val; + if (object->zo_data.zo_type == ENTRY_OBJ) { + entry = &object->zo_data.objdata_u.en_data; + DEBUG(5, ("NIS+ entry type: %s\n", entry->en_type)); + DEBUG(3, ("NIS+ result: %s\n", entry->en_cols.en_cols_val[1].ec_value.ec_value_val)); - pstrcpy(last_value, entry->en_cols.en_cols_val[1].ec_value.ec_value_val); - pstring_sub(last_value, "&", user_name); - fstrcpy(last_key, user_name); - } - } - } - nis_freeresult(result); - } + pstrcpy(last_value, entry->en_cols.en_cols_val[1].ec_value.ec_value_val); + pstring_sub(last_value, "&", user_name); + fstrcpy(last_key, user_name); + } + } + } + nis_freeresult(result); + } - strip_mount_options(&last_value); + strip_mount_options(&last_value); - DEBUG(4, ("NIS+ Lookup: %s resulted in %s\n", user_name, last_value)); - return last_value; + DEBUG(4, ("NIS+ Lookup: %s resulted in %s\n", user_name, last_value)); + return last_value; } #else /* WITH_NISPLUS_HOME */ + char *automount_lookup(const char *user_name) { - static fstring last_key = ""; - static pstring last_value = ""; - - int nis_error; /* returned by yp all functions */ - char *nis_result; /* yp_match inits this */ - int nis_result_len; /* and set this */ - char *nis_domain; /* yp_get_default_domain inits this */ - char *nis_map = (char *)lp_nis_home_map_name(); - - if ((nis_error = yp_get_default_domain(&nis_domain)) != 0) { - DEBUG(3, ("YP Error: %s\n", yperr_string(nis_error))); - return last_value; - } - - DEBUG(5, ("NIS Domain: %s\n", nis_domain)); - - if (!strcmp(user_name, last_key)) { - nis_result = last_value; - nis_result_len = strlen(last_value); - nis_error = 0; - - } else { - - if ((nis_error = yp_match(nis_domain, nis_map, - user_name, strlen(user_name), - &nis_result, &nis_result_len)) == 0) { - if (!nis_error && nis_result_len >= sizeof(pstring)) { - nis_result_len = sizeof(pstring)-1; - } - fstrcpy(last_key, user_name); - strncpy(last_value, nis_result, nis_result_len); - last_value[nis_result_len] = '\0'; - strip_mount_options(&last_value); - - } else if(nis_error == YPERR_KEY) { - - /* If Key lookup fails user home server is not in nis_map - use default information for server, and home directory */ - last_value[0] = 0; - DEBUG(3, ("YP Key not found: while looking up \"%s\" in map \"%s\"\n", - user_name, nis_map)); - DEBUG(3, ("using defaults for server and home directory\n")); - } else { - DEBUG(3, ("YP Error: \"%s\" while looking up \"%s\" in map \"%s\"\n", - yperr_string(nis_error), user_name, nis_map)); - } - } + static fstring last_key = ""; + static pstring last_value = ""; + int nis_error; /* returned by yp all functions */ + char *nis_result; /* yp_match inits this */ + int nis_result_len; /* and set this */ + char *nis_domain; /* yp_get_default_domain inits this */ + char *nis_map = (char *)lp_nis_home_map_name(); + + if ((nis_error = yp_get_default_domain(&nis_domain)) != 0) { + DEBUG(3, ("YP Error: %s\n", yperr_string(nis_error))); + return last_value; + } + + DEBUG(5, ("NIS Domain: %s\n", nis_domain)); + + if (!strcmp(user_name, last_key)) { + nis_result = last_value; + nis_result_len = strlen(last_value); + nis_error = 0; + } else { + if ((nis_error = yp_match(nis_domain, nis_map, user_name, strlen(user_name), + &nis_result, &nis_result_len)) == 0) { + if (!nis_error && nis_result_len >= sizeof(pstring)) { + nis_result_len = sizeof(pstring)-1; + } + fstrcpy(last_key, user_name); + strncpy(last_value, nis_result, nis_result_len); + last_value[nis_result_len] = '\0'; + strip_mount_options(&last_value); + + } else if(nis_error == YPERR_KEY) { + + /* If Key lookup fails user home server is not in nis_map + use default information for server, and home directory */ + last_value[0] = 0; + DEBUG(3, ("YP Key not found: while looking up \"%s\" in map \"%s\"\n", + user_name, nis_map)); + DEBUG(3, ("using defaults for server and home directory\n")); + } else { + DEBUG(3, ("YP Error: \"%s\" while looking up \"%s\" in map \"%s\"\n", + yperr_string(nis_error), user_name, nis_map)); + } + } - DEBUG(4, ("YP Lookup: %s resulted in %s\n", user_name, last_value)); - return last_value; + DEBUG(4, ("YP Lookup: %s resulted in %s\n", user_name, last_value)); + return last_value; } #endif /* WITH_NISPLUS_HOME */ #endif - /******************************************************************* -are two IPs on the same subnet? + Are two IPs on the same subnet? ********************************************************************/ + BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask) { - uint32 net1,net2,nmask; + uint32 net1,net2,nmask; - nmask = ntohl(mask.s_addr); - net1 = ntohl(ip1.s_addr); - net2 = ntohl(ip2.s_addr); + nmask = ntohl(mask.s_addr); + net1 = ntohl(ip1.s_addr); + net2 = ntohl(ip2.s_addr); - return((net1 & nmask) == (net2 & nmask)); + return((net1 & nmask) == (net2 & nmask)); } /**************************************************************************** -check if a process exists. Does this work on all unixes? + Check if a process exists. Does this work on all unixes? ****************************************************************************/ BOOL process_exists(pid_t pid) @@ -1048,7 +1250,6 @@ BOOL process_exists(pid_t pid) return(kill(pid,0) == 0 || errno != ESRCH); } - /******************************************************************* Convert a uid into a user name. ********************************************************************/ @@ -1130,8 +1331,9 @@ gid_t nametogid(const char *name) } /******************************************************************* -something really nasty happened - panic! + Something really nasty happened - panic ! ********************************************************************/ + void smb_panic(char *why) { char *cmd = lp_panic_action(); @@ -1153,24 +1355,27 @@ void smb_panic(char *why) abort(); } - /******************************************************************* -a readdir wrapper which just returns the file name + A readdir wrapper which just returns the file name. ********************************************************************/ + char *readdirname(DIR *p) { SMB_STRUCT_DIRENT *ptr; char *dname; - if (!p) return(NULL); + if (!p) + return(NULL); ptr = (SMB_STRUCT_DIRENT *)sys_readdir(p); - if (!ptr) return(NULL); + if (!ptr) + return(NULL); dname = ptr->d_name; #ifdef NEXT2 - if (telldir(p) < 0) return(NULL); + if (telldir(p) < 0) + return(NULL); #endif #ifdef HAVE_BROKEN_READDIR @@ -1196,46 +1401,39 @@ char *readdirname(DIR *p) BOOL is_in_path(char *name, name_compare_entry *namelist) { - pstring last_component; - char *p; - - DEBUG(8, ("is_in_path: %s\n", name)); - - /* if we have no list it's obviously not in the path */ - if((namelist == NULL ) || ((namelist != NULL) && (namelist[0].name == NULL))) - { - DEBUG(8,("is_in_path: no name list.\n")); - return False; - } - - /* Get the last component of the unix name. */ - p = strrchr_m(name, '/'); - strncpy(last_component, p ? ++p : name, sizeof(last_component)-1); - last_component[sizeof(last_component)-1] = '\0'; - - for(; namelist->name != NULL; namelist++) - { - if(namelist->is_wild) - { - if (mask_match(last_component, namelist->name, case_sensitive)) - { - DEBUG(8,("is_in_path: mask match succeeded\n")); - return True; - } - } - else - { - if((case_sensitive && (strcmp(last_component, namelist->name) == 0))|| - (!case_sensitive && (StrCaseCmp(last_component, namelist->name) == 0))) - { - DEBUG(8,("is_in_path: match succeeded\n")); - return True; - } - } - } - DEBUG(8,("is_in_path: match not found\n")); + pstring last_component; + char *p; + + DEBUG(8, ("is_in_path: %s\n", name)); + + /* if we have no list it's obviously not in the path */ + if((namelist == NULL ) || ((namelist != NULL) && (namelist[0].name == NULL))) { + DEBUG(8,("is_in_path: no name list.\n")); + return False; + } + + /* Get the last component of the unix name. */ + p = strrchr_m(name, '/'); + strncpy(last_component, p ? ++p : name, sizeof(last_component)-1); + last_component[sizeof(last_component)-1] = '\0'; + + for(; namelist->name != NULL; namelist++) { + if(namelist->is_wild) { + if (mask_match(last_component, namelist->name, case_sensitive)) { + DEBUG(8,("is_in_path: mask match succeeded\n")); + return True; + } + } else { + if((case_sensitive && (strcmp(last_component, namelist->name) == 0))|| + (!case_sensitive && (StrCaseCmp(last_component, namelist->name) == 0))) { + DEBUG(8,("is_in_path: match succeeded\n")); + return True; + } + } + } + DEBUG(8,("is_in_path: match not found\n")); - return False; + return False; } /******************************************************************* @@ -1253,99 +1451,92 @@ BOOL is_in_path(char *name, name_compare_entry *namelist) void set_namearray(name_compare_entry **ppname_array, char *namelist) { - char *name_end; - char *nameptr = namelist; - int num_entries = 0; - int i; - - (*ppname_array) = NULL; - - if((nameptr == NULL ) || ((nameptr != NULL) && (*nameptr == '\0'))) - return; - - /* We need to make two passes over the string. The - first to count the number of elements, the second - to split it. - */ - while(*nameptr) - { - if ( *nameptr == '/' ) - { - /* cope with multiple (useless) /s) */ - nameptr++; - continue; - } - /* find the next / */ - name_end = strchr_m(nameptr, '/'); + char *name_end; + char *nameptr = namelist; + int num_entries = 0; + int i; - /* oops - the last check for a / didn't find one. */ - if (name_end == NULL) - break; + (*ppname_array) = NULL; - /* next segment please */ - nameptr = name_end + 1; - num_entries++; - } + if((nameptr == NULL ) || ((nameptr != NULL) && (*nameptr == '\0'))) + return; - if(num_entries == 0) - return; + /* We need to make two passes over the string. The + first to count the number of elements, the second + to split it. + */ - if(( (*ppname_array) = (name_compare_entry *)malloc( - (num_entries + 1) * sizeof(name_compare_entry))) == NULL) - { - DEBUG(0,("set_namearray: malloc fail\n")); - return; - } + while(*nameptr) { + if ( *nameptr == '/' ) { + /* cope with multiple (useless) /s) */ + nameptr++; + continue; + } + /* find the next / */ + name_end = strchr_m(nameptr, '/'); - /* Now copy out the names */ - nameptr = namelist; - i = 0; - while(*nameptr) - { - if ( *nameptr == '/' ) - { - /* cope with multiple (useless) /s) */ - nameptr++; - continue; - } - /* find the next / */ - if ((name_end = strchr_m(nameptr, '/')) != NULL) - { - *name_end = 0; - } - - /* oops - the last check for a / didn't find one. */ - if(name_end == NULL) - break; - - (*ppname_array)[i].is_wild = ms_has_wild(nameptr); - if(((*ppname_array)[i].name = strdup(nameptr)) == NULL) - { - DEBUG(0,("set_namearray: malloc fail (1)\n")); - return; - } - - /* next segment please */ - nameptr = name_end + 1; - i++; - } + /* oops - the last check for a / didn't find one. */ + if (name_end == NULL) + break; + + /* next segment please */ + nameptr = name_end + 1; + num_entries++; + } + + if(num_entries == 0) + return; + + if(( (*ppname_array) = (name_compare_entry *)malloc( + (num_entries + 1) * sizeof(name_compare_entry))) == NULL) { + DEBUG(0,("set_namearray: malloc fail\n")); + return; + } + + /* Now copy out the names */ + nameptr = namelist; + i = 0; + while(*nameptr) { + if ( *nameptr == '/' ) { + /* cope with multiple (useless) /s) */ + nameptr++; + continue; + } + /* find the next / */ + if ((name_end = strchr_m(nameptr, '/')) != NULL) + *name_end = 0; + + /* oops - the last check for a / didn't find one. */ + if(name_end == NULL) + break; + + (*ppname_array)[i].is_wild = ms_has_wild(nameptr); + if(((*ppname_array)[i].name = strdup(nameptr)) == NULL) { + DEBUG(0,("set_namearray: malloc fail (1)\n")); + return; + } + + /* next segment please */ + nameptr = name_end + 1; + i++; + } - (*ppname_array)[i].name = NULL; + (*ppname_array)[i].name = NULL; - return; + return; } /**************************************************************************** -routine to free a namearray. + Routine to free a namearray. ****************************************************************************/ void free_namearray(name_compare_entry *name_array) { - if(name_array == NULL) - return; + if(name_array == NULL) + return; - SAFE_FREE(name_array->name); - SAFE_FREE(name_array); + SAFE_FREE(name_array->name); + SAFE_FREE(name_array); } /**************************************************************************** @@ -1355,50 +1546,47 @@ void free_namearray(name_compare_entry *name_array) BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { - SMB_STRUCT_FLOCK lock; - int ret; + SMB_STRUCT_FLOCK lock; + int ret; - DEBUG(8,("fcntl_lock %d %d %.0f %.0f %d\n",fd,op,(double)offset,(double)count,type)); + DEBUG(8,("fcntl_lock %d %d %.0f %.0f %d\n",fd,op,(double)offset,(double)count,type)); - lock.l_type = type; - lock.l_whence = SEEK_SET; - lock.l_start = offset; - lock.l_len = count; - lock.l_pid = 0; + lock.l_type = type; + lock.l_whence = SEEK_SET; + lock.l_start = offset; + lock.l_len = count; + lock.l_pid = 0; - ret = sys_fcntl_ptr(fd,op,&lock); + ret = sys_fcntl_ptr(fd,op,&lock); - if (ret == -1 && errno != 0) - DEBUG(3,("fcntl_lock: fcntl lock gave errno %d (%s)\n",errno,strerror(errno))); + if (ret == -1 && errno != 0) + DEBUG(3,("fcntl_lock: fcntl lock gave errno %d (%s)\n",errno,strerror(errno))); - /* a lock query */ - if (op == SMB_F_GETLK) - { - if ((ret != -1) && - (lock.l_type != F_UNLCK) && - (lock.l_pid != 0) && - (lock.l_pid != sys_getpid())) - { - DEBUG(3,("fcntl_lock: fd %d is locked by pid %d\n",fd,(int)lock.l_pid)); - return(True); - } + /* a lock query */ + if (op == SMB_F_GETLK) { + if ((ret != -1) && + (lock.l_type != F_UNLCK) && + (lock.l_pid != 0) && + (lock.l_pid != sys_getpid())) { + DEBUG(3,("fcntl_lock: fd %d is locked by pid %d\n",fd,(int)lock.l_pid)); + return(True); + } - /* it must be not locked or locked by me */ - return(False); - } + /* it must be not locked or locked by me */ + return(False); + } - /* a lock set or unset */ - if (ret == -1) - { - DEBUG(3,("fcntl_lock: lock failed at offset %.0f count %.0f op %d type %d (%s)\n", - (double)offset,(double)count,op,type,strerror(errno))); - return(False); - } + /* a lock set or unset */ + if (ret == -1) { + DEBUG(3,("fcntl_lock: lock failed at offset %.0f count %.0f op %d type %d (%s)\n", + (double)offset,(double)count,op,type,strerror(errno))); + return(False); + } - /* everything went OK */ - DEBUG(8,("fcntl_lock: Lock call successful\n")); + /* everything went OK */ + DEBUG(8,("fcntl_lock: Lock call successful\n")); - return(True); + return(True); } /******************************************************************* @@ -1406,14 +1594,16 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) Returns true if it is equal, false otherwise. ********************************************************************/ -BOOL is_myname(char *s) +BOOL is_myname(const char *s) { int n; BOOL ret = False; - for (n=0; my_netbios_names[n]; n++) { - if (strequal(my_netbios_names[n], s)) + for (n=0; my_netbios_names(n); n++) { + if (strequal(my_netbios_names(n), s)) { ret=True; + break; + } } DEBUG(8, ("is_myname(\"%s\") returns %d\n", s, ret)); return(ret); @@ -1437,12 +1627,10 @@ const char* get_my_primary_ip (void) return ip_string; } -BOOL is_myname_or_ipaddr(char *s) +BOOL is_myname_or_ipaddr(const char *s) { - char **ptr; - /* optimize for the common case */ - if (strequal(s, global_myname)) + if (strequal(s, global_myname())) return True; /* maybe its an IP address? */ @@ -1463,11 +1651,8 @@ BOOL is_myname_or_ipaddr(char *s) } /* check for an alias */ - ptr = lp_netbios_aliases(); - for ( ; *ptr; ptr++ ) { - if (StrCaseCmp(s, *ptr) == 0) - return True; - } + if (is_myname(s)) + return True; /* no match */ return False; @@ -1609,15 +1794,14 @@ char *tab_depth(int depth) } /***************************************************************************** - * Provide a checksum on a string - * - * Input: s - the null-terminated character string for which the checksum - * will be calculated. - * - * Output: The checksum value calculated for s. - * - * **************************************************************************** - */ + Provide a checksum on a string + + Input: s - the null-terminated character string for which the checksum + will be calculated. + + Output: The checksum value calculated for s. +*****************************************************************************/ + int str_checksum(const char *s) { int res = 0; @@ -1631,23 +1815,22 @@ int str_checksum(const char *s) i++; } return(res); -} /* str_checksum */ - - +} /***************************************************************** -zero a memory area then free it. Used to catch bugs faster + Zero a memory area then free it. Used to catch bugs faster. *****************************************************************/ + void zero_free(void *p, size_t size) { memset(p, 0, size); SAFE_FREE(p); } - /***************************************************************** -set our open file limit to a requested max and return the limit + Set our open file limit to a requested max and return the limit. *****************************************************************/ + int set_maxfiles(int requested_max) { #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)) @@ -1662,7 +1845,7 @@ int set_maxfiles(int requested_max) } /* - * Set the fd limit to be real_max_open_files + MAX_OPEN_FUDGEFACTOR to + * Set the fd limit to be real_max_open_files + MAX_OPEN_FUDGEFACTOR to * account for the extra fd we need * as well as the log files and standard * handles etc. Save the limit we want to set in case @@ -1715,7 +1898,7 @@ int set_maxfiles(int requested_max) return saved_current_limit; #endif - if((int)rlp.rlim_cur > saved_current_limit) + if((int)rlp.rlim_cur > saved_current_limit) return saved_current_limit; return rlp.rlim_cur; @@ -1728,53 +1911,43 @@ int set_maxfiles(int requested_max) } /***************************************************************** - splits out the start of the key (HKLM or HKU) and the rest of the key - *****************************************************************/ -BOOL reg_split_key(char *full_keyname, uint32 *reg_type, char *key_name) + Splits out the start of the key (HKLM or HKU) and the rest of the key. +*****************************************************************/ + +BOOL reg_split_key(const char *full_keyname, uint32 *reg_type, char *key_name) { pstring tmp; if (!next_token(&full_keyname, tmp, "\\", sizeof(tmp))) - { return False; - } (*reg_type) = 0; DEBUG(10, ("reg_split_key: hive %s\n", tmp)); if (strequal(tmp, "HKLM") || strequal(tmp, "HKEY_LOCAL_MACHINE")) - { (*reg_type) = HKEY_LOCAL_MACHINE; - } else if (strequal(tmp, "HKU") || strequal(tmp, "HKEY_USERS")) - { (*reg_type) = HKEY_USERS; - } - else - { + else { DEBUG(10,("reg_split_key: unrecognised hive key %s\n", tmp)); return False; } if (next_token(&full_keyname, tmp, "\n\r", sizeof(tmp))) - { fstrcpy(key_name, tmp); - } else - { key_name[0] = 0; - } DEBUG(10, ("reg_split_key: name %s\n", key_name)); return True; } - /***************************************************************** -possibly replace mkstemp if it is broken + Possibly replace mkstemp if it is broken. *****************************************************************/ + int smb_mkstemp(char *template) { #if HAVE_SECURE_MKSTEMP @@ -1783,7 +1956,8 @@ int smb_mkstemp(char *template) /* have a reasonable go at emulating it. Hope that the system mktemp() isn't completly hopeless */ char *p = mktemp(template); - if (!p) return -1; + if (!p) + return -1; return open(p, O_CREAT|O_EXCL|O_RDWR, 0600); #endif } @@ -1805,6 +1979,7 @@ void *smb_xmalloc(size_t size) /** Memdup with smb_panic on fail. **/ + void *smb_xmemdup(const void *p, size_t size) { void *p2; @@ -1816,6 +1991,7 @@ void *smb_xmemdup(const void *p, size_t size) /** strdup that aborts on malloc fail. **/ + char *smb_xstrdup(const char *s) { char *s1 = strdup(s); @@ -1827,6 +2003,7 @@ char *smb_xstrdup(const char *s) /** strndup that aborts on malloc fail. **/ + char *smb_xstrndup(const char *s, size_t n) { char *s1 = strndup(s, n); @@ -1838,6 +2015,7 @@ char *smb_xstrndup(const char *s, size_t n) /* vasprintf that aborts on malloc fail */ + int smb_xvasprintf(char **ptr, const char *format, va_list ap) { int n; @@ -1846,41 +2024,43 @@ int smb_xvasprintf(char **ptr, const char *format, va_list ap) VA_COPY(ap2, ap); n = vasprintf(ptr, format, ap2); - if (n == -1 || ! *ptr) { + if (n == -1 || ! *ptr) smb_panic("smb_xvasprintf: out of memory"); - } return n; } /***************************************************************** -like strdup but for memory - *****************************************************************/ + Like strdup but for memory. +*****************************************************************/ + void *memdup(const void *p, size_t size) { void *p2; - if (size == 0) return NULL; + if (size == 0) + return NULL; p2 = malloc(size); - if (!p2) return NULL; + if (!p2) + return NULL; memcpy(p2, p, size); return p2; } /***************************************************************** -get local hostname and cache result - *****************************************************************/ + Get local hostname and cache result. +*****************************************************************/ + char *myhostname(void) { static pstring ret; - if (ret[0] == 0) { + if (ret[0] == 0) get_myname(ret); - } return ret; } - /***************************************************************** -a useful function for returning a path in the Samba lock directory - *****************************************************************/ + A useful function for returning a path in the Samba lock directory. +*****************************************************************/ + char *lock_path(const char *name) { static pstring fname; @@ -1888,9 +2068,8 @@ char *lock_path(const char *name) pstrcpy(fname,lp_lockdir()); trim_string(fname,"","/"); - if (!directory_exist(fname,NULL)) { + if (!directory_exist(fname,NULL)) mkdir(fname,0755); - } pstrcat(fname,"/"); pstrcat(fname,name); @@ -1899,8 +2078,9 @@ char *lock_path(const char *name) } /***************************************************************** -a useful function for returning a path in the Samba pid directory - *****************************************************************/ + A useful function for returning a path in the Samba pid directory. +*****************************************************************/ + char *pid_path(const char *name) { static pstring fname; @@ -1908,9 +2088,8 @@ char *pid_path(const char *name) pstrcpy(fname,lp_piddir()); trim_string(fname,"","/"); - if (!directory_exist(fname,NULL)) { + if (!directory_exist(fname,NULL)) mkdir(fname,0755); - } pstrcat(fname,"/"); pstrcat(fname,name); @@ -1918,7 +2097,6 @@ char *pid_path(const char *name) return fname; } - /** * @brief Returns an absolute path to a file in the Samba lib directory. * @@ -1926,6 +2104,7 @@ char *pid_path(const char *name) * * @retval Pointer to a static #pstring containing the full path. **/ + char *lib_path(const char *name) { static pstring fname; @@ -1963,8 +2142,9 @@ char *parent_dirname(const char *path) /******************************************************************* -determine if a pattern contains any Microsoft wildcard characters - *******************************************************************/ + Determine if a pattern contains any Microsoft wildcard characters. +*******************************************************************/ + BOOL ms_has_wild(char *s) { char c; @@ -1999,19 +2179,21 @@ BOOL ms_has_wild_w(const smb_ucs2_t *s) } /******************************************************************* - a wrapper that handles case sensitivity and the special handling - of the ".." name - *******************************************************************/ + A wrapper that handles case sensitivity and the special handling + of the ".." name. +*******************************************************************/ + BOOL mask_match(char *string, char *pattern, BOOL is_case_sensitive) { fstring p2, s2; - if (strcmp(string,"..") == 0) string = "."; - if (strcmp(pattern,".") == 0) return False; + if (strcmp(string,"..") == 0) + string = "."; + if (strcmp(pattern,".") == 0) + return False; - if (is_case_sensitive) { + if (is_case_sensitive) return ms_fnmatch(pattern, string, Protocol) == 0; - } fstrcpy(p2, pattern); fstrcpy(s2, string); @@ -2153,6 +2335,7 @@ This routine is a trick to immediately catch errors when debugging with insure. A xterm with a gdb is popped up when insure catches a error. It is Linux specific. ********************************************************************/ + int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6) { static int (*fn)(); diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index f0daf9787e8..edd59ae1094 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -24,9 +24,6 @@ #include "includes.h" -extern pstring global_myname; -extern fstring global_myworkgroup; - /* * Some useful sids */ @@ -178,7 +175,7 @@ NT_USER_TOKEN *get_system_token(void) /************************************************************************** Splits a name of format \DOMAIN\name or name into its two components. - Sets the DOMAIN name to global_myname if it has not been specified. + Sets the DOMAIN name to global_myname() if it has not been specified. ***************************************************************************/ void split_domain_name(const char *fullname, char *domain, char *name) @@ -202,7 +199,7 @@ void split_domain_name(const char *fullname, char *domain, char *name) fstrcpy(domain, full_name); fstrcpy(name, p+1); } else { - fstrcpy(domain, global_myname); + fstrcpy(domain, global_myname()); fstrcpy(name, full_name); } @@ -280,7 +277,8 @@ const char *sid_string_static(const DOM_SID *sid) BOOL string_to_sid(DOM_SID *sidout, const char *sidstr) { pstring tok; - char *p, *q; + char *q; + const char *p; /* BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 */ uint32 ia; @@ -291,7 +289,7 @@ BOOL string_to_sid(DOM_SID *sidout, const char *sidstr) memset((char *)sidout, '\0', sizeof(DOM_SID)); - q = p = strdup(sidstr + 2); + p = q = strdup(sidstr + 2); if (p == NULL) { DEBUG(0, ("string_to_sid: out of memory!\n")); return False; diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 04c20f65967..2acb20861b9 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -108,7 +108,7 @@ static void print_socket_options(int s) Set user socket options. ****************************************************************************/ -void set_socket_options(int fd, char *options) +void set_socket_options(int fd, const char *options) { fstring tok; diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 6d1f8fe023b..32efee1536a 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -28,9 +28,9 @@ Extensively modified by Andrew.Tridgell@anu.edu.au ****************************************************************************/ -BOOL next_token(char **ptr,char *buff, const char *sep, size_t bufsize) +BOOL next_token(const char **ptr,char *buff, const char *sep, size_t bufsize) { - char *s; + const char *s; BOOL quoted; size_t len=1; @@ -75,11 +75,11 @@ but beware the fact that it is not re-entrant! static char *last_ptr=NULL; -BOOL next_token_nr(char **ptr,char *buff, const char *sep, size_t bufsize) +BOOL next_token_nr(const char **ptr,char *buff, const char *sep, size_t bufsize) { BOOL ret; if (!ptr) - ptr = &last_ptr; + ptr = (const char **)&last_ptr; ret = next_token(ptr, buff, sep, bufsize); last_ptr = *ptr; @@ -613,7 +613,7 @@ size_t strhex_to_str(char *p, size_t len, const char *strhex) BOOL in_list(char *s,char *list,BOOL casesensitive) { pstring tok; - char *p=list; + const char *p=list; if (!list) return(False); @@ -1185,7 +1185,8 @@ int fstr_sprintf(fstring s, const char *fmt, ...) char **str_list_make(const char *string, const char *sep) { char **list, **rlist; - char *str, *s; + const char *str; + char *s; int num, lsize; pstring tok; @@ -1231,7 +1232,7 @@ char **str_list_make(const char *string, const char *sep) return list; } -BOOL str_list_copy(char ***dest, char **src) +BOOL str_list_copy(char ***dest, const char **src) { char **list, **rlist; int num, lsize; diff --git a/source3/lib/wins_srv.c b/source3/lib/wins_srv.c index 61e77aca587..01dfd6dd620 100644 --- a/source3/lib/wins_srv.c +++ b/source3/lib/wins_srv.c @@ -154,7 +154,7 @@ void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip) */ unsigned wins_srv_count(void) { - char **list; + const char **list; int count = 0; if (lp_wins_support()) { @@ -163,7 +163,8 @@ unsigned wins_srv_count(void) } list = lp_wins_server_list(); - for (count=0; list && list[count]; count++) /* nop */ ; + for (count=0; list && list[count]; count++) + /* nop */ ; return count; } @@ -202,7 +203,7 @@ char **wins_srv_tags(void) { char **ret = NULL; int count=0, i, j; - char **list; + const char **list; if (lp_wins_support()) { /* give the caller something to chew on. This makes @@ -215,7 +216,8 @@ char **wins_srv_tags(void) } list = lp_wins_server_list(); - if (!list) return NULL; + if (!list) + return NULL; /* yes, this is O(n^2) but n is very small */ for (i=0;list[i];i++) { @@ -268,7 +270,7 @@ void wins_srv_tags_free(char **list) */ struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip) { - char **list; + const char **list; int i; struct tagged_ip t_ip; @@ -324,7 +326,7 @@ struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip) */ unsigned wins_srv_count_tag(const char *tag) { - char **list; + const char **list; int i, count=0; /* if we are a wins server then we always just talk to ourselves */ diff --git a/source3/libads/kerberos_verify.c b/source3/libads/kerberos_verify.c index 52fd2e68628..03917466c6d 100644 --- a/source3/libads/kerberos_verify.c +++ b/source3/libads/kerberos_verify.c @@ -42,7 +42,6 @@ NTSTATUS ads_verify_ticket(ADS_STRUCT *ads, const DATA_BLOB *ticket, krb5_keyblock * key; krb5_principal host_princ; char *host_princ_s; - extern pstring global_myname; fstring myname; char *password_s; krb5_data password; @@ -83,7 +82,7 @@ NTSTATUS ads_verify_ticket(ADS_STRUCT *ads, const DATA_BLOB *ticket, return NT_STATUS_LOGON_FAILURE; } - fstrcpy(myname, global_myname); + fstrcpy(myname, global_myname()); strlower(myname); asprintf(&host_princ_s, "HOST/%s@%s", myname, lp_realm()); ret = krb5_parse_name(context, host_princ_s, &host_princ); diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index a59b78bf13f..d5cd56001be 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -105,26 +105,28 @@ static int ldap_ip_compare(struct ldap_ip *ip1, struct ldap_ip *ip2) /* try connecting to a ldap server via DNS */ static BOOL ads_try_dns(ADS_STRUCT *ads) { - char *realm, *ptr; + const char *c_realm; + const char *ptr; + char *realm; char *list = NULL; pstring tok; struct ldap_ip *ip_list; int count, i=0; - realm = ads->server.realm; - if (!realm || !*realm) { - realm = lp_realm(); + c_realm = ads->server.realm; + if (!c_realm || !*c_realm) { + c_realm = lp_realm(); } - if (!realm || !*realm) { - realm = ads->server.workgroup; + if (!c_realm || !*c_realm) { + c_realm = ads->server.workgroup; } - if (!realm || !*realm) { - realm = lp_workgroup(); + if (!c_realm || !*c_realm) { + c_realm = lp_workgroup(); } - if (!realm) { + if (!c_realm) { return False; } - realm = smb_xstrdup(realm); + realm = smb_xstrdup(c_realm); DEBUG(6,("ads_try_dns: looking for realm '%s'\n", realm)); if (ldap_domain2hostlist(realm, &list) != LDAP_SUCCESS) { @@ -183,7 +185,7 @@ static BOOL ads_try_netbios(ADS_STRUCT *ads) struct in_addr *ip_list, pdc_ip; int count; int i; - char *workgroup = ads->server.workgroup; + const char *workgroup = ads->server.workgroup; if (!workgroup) { workgroup = lp_workgroup(); @@ -273,9 +275,8 @@ got_connection: if (!ads->auth.user_name) { /* by default use the machine account */ - extern pstring global_myname; fstring myname; - fstrcpy(myname, global_myname); + fstrcpy(myname, global_myname()); strlower(myname); asprintf(&ads->auth.user_name, "HOST/%s", myname); } @@ -435,8 +436,7 @@ ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path, else { /* This would be the utf8-encoded version...*/ /* if (!(search_attrs = ads_push_strvals(ctx, attrs))) */ - if (!(str_list_copy(&search_attrs, attrs))) - { + if (!(str_list_copy(&search_attrs, attrs))) { rc = LDAP_NO_MEMORY; goto done; } @@ -1026,7 +1026,8 @@ static ADS_STATUS ads_add_machine_acct(ADS_STRUCT *ads, const char *hostname, ADS_MODLIST mods; const char *objectClass[] = {"top", "person", "organizationalPerson", "user", "computer", NULL}; - char *servicePrincipalName[3] = {NULL, NULL, NULL}; + const char *servicePrincipalName[3] = {NULL, NULL, NULL}; + char *psp; unsigned acct_control; if (!(ctx = talloc_init_named("machine_account"))) @@ -1046,10 +1047,11 @@ static ADS_STATUS ads_add_machine_acct(ADS_STRUCT *ads, const char *hostname, new_dn = talloc_asprintf(ctx, "cn=%s,%s,%s", hostname, ou_str, ads->config.bind_path); servicePrincipalName[0] = talloc_asprintf(ctx, "HOST/%s", hostname); - servicePrincipalName[1] = talloc_asprintf(ctx, "HOST/%s.%s", + psp = talloc_asprintf(ctx, "HOST/%s.%s", hostname, ads->config.realm); - strlower(&servicePrincipalName[1][5]); + strlower(&psp[5]); + servicePrincipalName[1] = psp; free(ou_str); if (!new_dn) diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c index 66984477b81..0185bf78113 100644 --- a/source3/libads/ldap_printer.c +++ b/source3/libads/ldap_printer.c @@ -28,7 +28,7 @@ results can be used. It should be freed using ads_msgfree. */ ADS_STATUS ads_find_printer_on_server(ADS_STRUCT *ads, void **res, - const char *printer, char *servername) + const char *printer, const char *servername) { ADS_STATUS status; char *srv_dn, **srv_cn, *exp; @@ -77,7 +77,7 @@ ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn, ads_mod_str(ctx, &mods, "versionNumber", prt->versionNumber); /* now the optional ones */ - ads_mod_strlist(ctx, &mods, "description", prt->description); + ads_mod_strlist(ctx, &mods, "description", (const char **)prt->description); ads_mod_str(ctx, &mods, "assetNumber",prt->assetNumber); ads_mod_str(ctx, &mods, "bytesPerMinute",prt->bytesPerMinute); ads_mod_str(ctx, &mods, "defaultPriority",prt->defaultPriority); @@ -93,10 +93,10 @@ ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn, prt->operatingSystemVersion); ads_mod_str(ctx, &mods, "physicalLocationObject", prt->physicalLocationObject); - ads_mod_strlist(ctx, &mods, "portName", prt->portName); + ads_mod_strlist(ctx, &mods, "portName", (const char **)prt->portName); ads_mod_str(ctx, &mods, "printStartTime", prt->printStartTime); ads_mod_str(ctx, &mods, "printEndTime", prt->printEndTime); - ads_mod_strlist(ctx, &mods, "printBinNames", prt->printBinNames); + ads_mod_strlist(ctx, &mods, "printBinNames", (const char **)prt->printBinNames); /*... and many others */ /* do the ldap modify */ @@ -107,7 +107,6 @@ ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn, return status; } - /* add a printer to the directory diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c index 16ad397d0e2..7aa77bf2a24 100644 --- a/source3/libads/sasl.c +++ b/source3/libads/sasl.c @@ -36,7 +36,6 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads) uint32 neg_flags; struct berval cred, *scred; ADS_STATUS status; - extern pstring global_myname; int rc; if (!ads->auth.password) { @@ -97,7 +96,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads) nthash, 24, lp_workgroup(), ads->auth.user_name, - global_myname, + global_myname(), sess_key, 16, neg_flags); diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index ee311932a7f..584ad151743 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -44,8 +44,8 @@ static const struct { Do an old lanman2 style session setup. ****************************************************************************/ -static BOOL cli_session_setup_lanman2(struct cli_state *cli, char *user, - char *pass, int passlen, const char *workgroup) +static BOOL cli_session_setup_lanman2(struct cli_state *cli, const char *user, + const char *pass, int passlen, const char *workgroup) { fstring pword; char *p; @@ -183,8 +183,8 @@ static BOOL cli_session_setup_guest(struct cli_state *cli) Do a NT1 plaintext session setup. ****************************************************************************/ -static BOOL cli_session_setup_plaintext(struct cli_state *cli, char *user, - char *pass, char *workgroup) +static BOOL cli_session_setup_plaintext(struct cli_state *cli, const char *user, + const char *pass, const char *workgroup) { uint32 capabilities = cli_session_setup_capabilities(cli); char *p; @@ -228,7 +228,7 @@ static BOOL cli_session_setup_plaintext(struct cli_state *cli, char *user, return True; } -static void set_signing_on_cli (struct cli_state *cli, char* pass, uint8 response[24]) +static void set_signing_on_cli (struct cli_state *cli, const char* pass, uint8 response[24]) { uint8 zero_sig[8]; ZERO_STRUCT(zero_sig); @@ -264,10 +264,10 @@ static void set_temp_signing_on_cli(struct cli_state *cli) @param workgroup The user's domain. ****************************************************************************/ -static BOOL cli_session_setup_nt1(struct cli_state *cli, char *user, - char *pass, int passlen, - char *ntpass, int ntpasslen, - char *workgroup) +static BOOL cli_session_setup_nt1(struct cli_state *cli, const char *user, + const char *pass, int passlen, + const char *ntpass, int ntpasslen, + const char *workgroup) { uint32 capabilities = cli_session_setup_capabilities(cli); uchar pword[24]; @@ -423,7 +423,7 @@ static DATA_BLOB cli_session_setup_blob(struct cli_state *cli, DATA_BLOB blob) Do a spnego/kerberos encrypted session setup. ****************************************************************************/ -static BOOL cli_session_setup_kerberos(struct cli_state *cli, char *principal, char *workgroup) +static BOOL cli_session_setup_kerberos(struct cli_state *cli, const char *principal, const char *workgroup) { DATA_BLOB blob2, negTokenTarg; @@ -453,8 +453,8 @@ static BOOL cli_session_setup_kerberos(struct cli_state *cli, char *principal, c Do a spnego/NTLMSSP encrypted session setup. ****************************************************************************/ -static BOOL cli_session_setup_ntlmssp(struct cli_state *cli, char *user, - char *pass, char *workgroup) +static BOOL cli_session_setup_ntlmssp(struct cli_state *cli, const char *user, + const char *pass, const char *workgroup) { DATA_BLOB msg1, struct_blob; DATA_BLOB blob, chal1, chal2, auth, challenge_blob; @@ -581,8 +581,8 @@ static BOOL cli_session_setup_ntlmssp(struct cli_state *cli, char *user, Do a spnego encrypted session setup. ****************************************************************************/ -static BOOL cli_session_setup_spnego(struct cli_state *cli, char *user, - char *pass, char *workgroup) +static BOOL cli_session_setup_spnego(struct cli_state *cli, const char *user, + const char *pass, const char *workgroup) { char *principal; char *OIDs[ASN1_MAX_OIDS]; @@ -646,10 +646,10 @@ ntlmssp: ****************************************************************************/ BOOL cli_session_setup(struct cli_state *cli, - char *user, - char *pass, int passlen, - char *ntpass, int ntpasslen, - char *workgroup) + const char *user, + const char *pass, int passlen, + const char *ntpass, int ntpasslen, + const char *workgroup) { char *p; fstring user2; @@ -1130,8 +1130,8 @@ BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip) Initialise client credentials for authenticated pipe access. ****************************************************************************/ -static void init_creds(struct ntuser_creds *creds, char* username, - char* domain, char* password) +static void init_creds(struct ntuser_creds *creds, const char* username, + const char* domain, const char* password) { ZERO_STRUCTP(creds); @@ -1163,9 +1163,9 @@ NTSTATUS cli_full_connection(struct cli_state **output_cli, const char *my_name, const char *dest_host, struct in_addr *dest_ip, int port, - char *service, char *service_type, - char *user, char *domain, - char *password, int flags, + const char *service, const char *service_type, + const char *user, const char *domain, + const char *password, int flags, BOOL *retry) { struct ntuser_creds creds; @@ -1174,13 +1174,12 @@ NTSTATUS cli_full_connection(struct cli_state **output_cli, struct nmb_name called; struct cli_state *cli; struct in_addr ip; - extern pstring global_myname; if (retry) *retry = False; if (!my_name) - my_name = global_myname; + my_name = global_myname(); if (!(cli = cli_initialise(NULL))) return NT_STATUS_NO_MEMORY; @@ -1258,7 +1257,7 @@ again: if (service) { if (!cli_send_tconX(cli, service, service_type, - (char*)password, strlen(password)+1)) { + password, strlen(password)+1)) { DEBUG(1,("failed tcon_X with %s\n", nt_errstr(nt_status))); nt_status = cli_nt_error(cli); cli_shutdown(cli); diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 8fdf145625a..5c3d942b906 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -471,7 +471,8 @@ BOOL getlmhostsent( XFILE *fp, pstring name, int *name_type, struct in_addr *ipa while(!x_feof(fp) && !x_ferror(fp)) { pstring ip,flags,extra; - char *ptr; + const char *ptr; + char *ptr1; int count = 0; *name_type = -1; @@ -524,20 +525,20 @@ BOOL getlmhostsent( XFILE *fp, pstring name, int *name_type, struct in_addr *ipa /* Extra feature. If the name ends in '#XX', where XX is a hex number, then only add that name type. */ - if((ptr = strchr_m(name, '#')) != NULL) + if((ptr1 = strchr_m(name, '#')) != NULL) { char *endptr; - ptr++; - *name_type = (int)strtol(ptr, &endptr, 16); + ptr1++; + *name_type = (int)strtol(ptr1, &endptr, 16); - if(!*ptr || (endptr == ptr)) + if(!*ptr1 || (endptr == ptr1)) { DEBUG(0,("getlmhostsent: invalid name %s containing '#'.\n", name)); continue; } - *(--ptr) = '\0'; /* Truncate at the '#' */ + *(--ptr1) = '\0'; /* Truncate at the '#' */ } return True; @@ -787,7 +788,7 @@ static BOOL internal_resolve_name(const char *name, int name_type, { pstring name_resolve_list; fstring tok; - char *ptr; + const char *ptr; BOOL allones = (strcmp(name,"255.255.255.255") == 0); BOOL allzeros = (strcmp(name,"0.0.0.0") == 0); BOOL is_address = is_ipaddress(name); @@ -1242,7 +1243,7 @@ BOOL get_dc_list(const char *domain, struct in_addr **ip_list, int *count) */ if (strequal(domain, lp_workgroup())) { - char *p; + const char *p; char *pserver = lp_passwordserver(); fstring name; int num_adresses = 0; diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index ba0d8cee5de..43e32aebbdb 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -28,14 +28,14 @@ static const struct opcode_names { char *nmb_opcode_name; int opcode; } nmb_header_opcode_names[] = { - {"Query", 0 }, - {"Registration", 5 }, - {"Release", 6 }, - {"WACK", 7 }, - {"Refresh", 8 }, - {"Refresh(altcode)", 9 }, - {"Multi-homed Registration", 15 }, - {0, -1 } + {"Query", 0 }, + {"Registration", 5 }, + {"Release", 6 }, + {"WACK", 7 }, + {"Refresh", 8 }, + {"Refresh(altcode)", 9 }, + {"Multi-homed Registration", 15 }, + {0, -1 } }; /**************************************************************************** @@ -814,15 +814,15 @@ static int build_dgram(char *buf,struct packet_struct *p) } /******************************************************************* - build a nmb name - *******************************************************************/ + Build a nmb name +*******************************************************************/ + void make_nmb_name( struct nmb_name *n, const char *name, int type) { - extern pstring global_scope; memset( (char *)n, '\0', sizeof(struct nmb_name) ); push_ascii(n->name, name, 16, STR_TERMINATE|STR_UPPER); n->name_type = (unsigned int)type & 0xFF; - StrnCpy( n->scope, global_scope, 63 ); + StrnCpy( n->scope, global_scope(), 63 ); strupper( n->scope ); } @@ -1180,7 +1180,6 @@ int name_mangle( char *In, char *Out, char name_type ) int len; char buf[20]; char *p = Out; - extern pstring global_scope; /* Safely copy the input string, In, into buf[]. */ (void)memset( buf, 0, 20 ); @@ -1204,9 +1203,9 @@ int name_mangle( char *In, char *Out, char name_type ) p[0] = '\0'; /* Add the scope string. */ - for( i = 0, len = 0; NULL != global_scope; i++, len++ ) + for( i = 0, len = 0; NULL != global_scope(); i++, len++ ) { - switch( global_scope[i] ) + switch( (global_scope())[i] ) { case '\0': p[0] = len; @@ -1219,7 +1218,7 @@ int name_mangle( char *In, char *Out, char name_type ) len = -1; break; default: - p[len+1] = global_scope[i]; + p[len+1] = (global_scope())[i]; break; } } diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c index b96bdc95a1c..41b60955206 100644 --- a/source3/libsmb/passchange.c +++ b/source3/libsmb/passchange.c @@ -20,9 +20,6 @@ #include "includes.h" - -extern pstring global_myname; - /************************************************************* change a password on a remote machine using IPC calls *************************************************************/ @@ -50,7 +47,7 @@ BOOL remote_password_change(const char *remote_machine, const char *user_name, return False; } - make_nmb_name(&calling, global_myname , 0x0); + make_nmb_name(&calling, global_myname() , 0x0); make_nmb_name(&called , remote_machine, 0x20); if (!cli_session_request(&cli, &calling, &called)) { diff --git a/source3/libsmb/pwd_cache.c b/source3/libsmb/pwd_cache.c index fc0602507ab..7ddcf853c42 100644 --- a/source3/libsmb/pwd_cache.c +++ b/source3/libsmb/pwd_cache.c @@ -41,7 +41,7 @@ static void pwd_init(struct pwd_info *pwd) Makes lm and nt hashed passwords. ****************************************************************************/ -static void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr) +static void pwd_make_lm_nt_16(struct pwd_info *pwd, const char *clr) { pstring dos_passwd; @@ -59,7 +59,7 @@ static void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr) Stores a cleartext password. ****************************************************************************/ -void pwd_set_cleartext(struct pwd_info *pwd, char *clr) +void pwd_set_cleartext(struct pwd_info *pwd, const char *clr) { pwd_init(pwd); push_ascii_fstring(pwd->password, clr); @@ -138,13 +138,3 @@ void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24], uchar nt_owf[24]) if (nt_owf != NULL) memcpy(nt_owf, pwd->smb_nt_owf, 24); } - - - - - - - - - - diff --git a/source3/libsmb/trust_passwd.c b/source3/libsmb/trust_passwd.c index 4d7acd19888..cf9fd58b13f 100644 --- a/source3/libsmb/trust_passwd.c +++ b/source3/libsmb/trust_passwd.c @@ -20,8 +20,6 @@ #include "includes.h" -extern pstring global_myname; - /********************************************************* Change the domain password on the PDC. @@ -45,7 +43,7 @@ static NTSTATUS just_change_the_password(struct cli_state *cli, TALLOC_CTX *mem_ return result; } - result = cli_net_srv_pwset(cli, mem_ctx, global_myname, new_trust_passwd_hash); + result = cli_net_srv_pwset(cli, mem_ctx, global_myname(), new_trust_passwd_hash); if (!NT_STATUS_IS_OK(result)) { DEBUG(0,("just_change_the_password: unable to change password (%s)!\n", @@ -99,7 +97,7 @@ NTSTATUS trust_pw_change_and_store_it(struct cli_state *cli, TALLOC_CTX *mem_ctx **********************************************************/ NTSTATUS trust_pw_find_change_and_store_it(struct cli_state *cli, TALLOC_CTX *mem_ctx, - char *domain) + const char *domain) { unsigned char old_trust_passwd_hash[16]; char *up_domain; diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 50730d40f35..5987d70a457 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -27,10 +27,6 @@ int ClientNMB = -1; int ClientDGRAM = -1; int global_nmb_port = -1; -extern pstring global_myname; -extern fstring global_myworkgroup; -extern char **my_netbios_names; - extern BOOL global_in_nmbd; /* are we running as a daemon ? */ @@ -564,98 +560,6 @@ static BOOL open_sockets(BOOL isdaemon, int port) return( True ); } -/**************************************************************************** ** - Initialise connect, service and file structs. - **************************************************************************** */ - -static BOOL init_structs(void) -{ - extern fstring local_machine; - char *p, **ptr; - int namecount; - int n; - int nodup; - char *nbname; - - if (! *global_myname) - { - fstrcpy( global_myname, myhostname() ); - p = strchr_m( global_myname, '.' ); - if (p) - *p = 0; - } - strupper( global_myname ); - - /* Add any NETBIOS name aliases. Ensure that the first entry - is equal to global_myname. - */ - /* Work out the max number of netbios aliases that we have */ - ptr = lp_netbios_aliases(); - namecount = 0; - if (ptr) - for( ; *ptr; namecount++,ptr++ ) - ; - if ( *global_myname ) - namecount++; - - /* Allocate space for the netbios aliases */ - my_netbios_names = (char **)malloc( sizeof(char *) * (namecount+1) ); - if( NULL == my_netbios_names ) - { - DEBUG( 0, ( "init_structs: malloc fail.\n" ) ); - return( False ); - } - - /* Use the global_myname string first */ - namecount=0; - if ( *global_myname ) - my_netbios_names[namecount++] = global_myname; - - ptr = lp_netbios_aliases(); - if (ptr) - { - while ( *ptr ) - { - nbname = strdup(*ptr); - if (nbname == NULL) - { - DEBUG(0,("init_structs: malloc fail when allocating names.\n")); - return False; - } - strupper( nbname ); - /* Look for duplicates */ - nodup=1; - for( n=0; nname, subrec->subnet_name)); /* Set the state back to DOMAIN_NONE. */ work->dom_state = DOMAIN_NONE; - if((servrec = find_server_in_workgroup( work, global_myname)) == NULL) + if((servrec = find_server_in_workgroup( work, global_myname())) == NULL) { DEBUG(0,("become_domain_master_fail: Error - cannot find server %s \ in workgroup %s on subnet %s\n", - global_myname, work->work_group, subrec->subnet_name)); + global_myname(), work->work_group, subrec->subnet_name)); return; } @@ -92,11 +89,11 @@ workgroup %s on subnet %s\n", registered_name->name, subrec->subnet_name)); return; } - if((servrec = find_server_in_workgroup( work, global_myname)) == NULL) + if((servrec = find_server_in_workgroup( work, global_myname())) == NULL) { DEBUG(0,("become_domain_master_stage2: Error - cannot find server %s \ in workgroup %s on subnet %s\n", - global_myname, registered_name->name, subrec->subnet_name)); + global_myname(), registered_name->name, subrec->subnet_name)); work->dom_state = DOMAIN_NONE; return; } @@ -112,7 +109,7 @@ in workgroup %s on subnet %s\n", if( DEBUGLVL( 0 ) ) { - dbgtext( "*****\n\nSamba server %s ", global_myname ); + dbgtext( "*****\n\nSamba server %s ", global_myname() ); dbgtext( "is now a domain master browser for " ); dbgtext( "workgroup %s ", work->work_group ); dbgtext( "on subnet %s\n\n*****\n", subrec->subnet_name ); @@ -128,7 +125,7 @@ in workgroup %s on subnet %s\n", will stop us syncing with ourself if we are also a local master browser. */ - make_nmb_name(&nmbname, global_myname, 0x20); + make_nmb_name(&nmbname, global_myname(), 0x20); work->dmb_name = nmbname; /* Pick the first interface ip address as the domain master browser ip. */ @@ -266,7 +263,7 @@ querying WINS server for name %s.\n", Attempt to become a domain master browser on all broadcast subnets. ****************************************************************************/ -static void become_domain_master_browser_bcast(char *workgroup_name) +static void become_domain_master_browser_bcast(const char *workgroup_name) { struct subnet_record *subrec; @@ -315,7 +312,7 @@ for domain master browser on workgroup %s\n", subrec->subnet_name, workgroup_nam Attempt to become a domain master browser by registering with WINS. ****************************************************************************/ -static void become_domain_master_browser_wins(char *workgroup_name) +static void become_domain_master_browser_wins(const char *workgroup_name) { struct work_record *work; @@ -391,9 +388,9 @@ void add_domain_names(time_t t) 1.9.16p2 to 1.9.16p11 - due to a bug in namelogon.c, cannot provide domain master / domain logon services. */ - become_domain_master_browser_wins(global_myworkgroup); + become_domain_master_browser_wins(lp_workgroup()); } else - become_domain_master_browser_bcast(global_myworkgroup); + become_domain_master_browser_bcast(lp_workgroup()); } } diff --git a/source3/nmbd/nmbd_become_lmb.c b/source3/nmbd/nmbd_become_lmb.c index 3e0884567e7..7b8ba14bb54 100644 --- a/source3/nmbd/nmbd_become_lmb.c +++ b/source3/nmbd/nmbd_become_lmb.c @@ -23,8 +23,6 @@ #include "includes.h" -extern pstring global_myname; - extern uint16 samba_nb_type; /* Samba's NetBIOS name type. */ /******************************************************************* @@ -89,11 +87,11 @@ subnet %s.\n", workgroup_name, subrec->subnet_name )); return; } - if((servrec = find_server_in_workgroup( work, global_myname)) == NULL) + if((servrec = find_server_in_workgroup( work, global_myname())) == NULL) { DEBUG(0,("reset_workgroup_state: Error - cannot find server %s \ in workgroup %s on subnet %s\n", - global_myname, work->work_group, subrec->subnet_name)); + global_myname(), work->work_group, subrec->subnet_name)); work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE; return; } @@ -153,7 +151,7 @@ static void unbecome_local_master_success(struct subnet_record *subrec, if( DEBUGLVL( 0 ) ) { dbgtext( "*****\n\n" ); - dbgtext( "Samba name server %s ", global_myname ); + dbgtext( "Samba name server %s ", global_myname() ); dbgtext( "has stopped being a local master browser " ); dbgtext( "for workgroup %s ", released_name->name ); dbgtext( "on subnet %s\n\n*****\n", subrec->subnet_name ); @@ -188,7 +186,7 @@ Removing from namelist anyway.\n", nmb_namestr(fail_name))); if( DEBUGLVL( 0 ) ) { dbgtext( "*****\n\n" ); - dbgtext( "Samba name server %s ", global_myname ); + dbgtext( "Samba name server %s ", global_myname() ); dbgtext( "has stopped being a local master browser " ); dbgtext( "for workgroup %s ", fail_name->name ); dbgtext( "on subnet %s\n\n*****\n", subrec->subnet_name ); @@ -285,11 +283,11 @@ void unbecome_local_master_browser(struct subnet_record *subrec, struct work_rec DEBUG(2,("unbecome_local_master_browser: unbecoming local master for workgroup %s \ on subnet %s\n",work->work_group, subrec->subnet_name)); - if(find_server_in_workgroup( work, global_myname) == NULL) + if(find_server_in_workgroup( work, global_myname()) == NULL) { DEBUG(0,("unbecome_local_master_browser: Error - cannot find server %s \ in workgroup %s on subnet %s\n", - global_myname, work->work_group, subrec->subnet_name)); + global_myname(), work->work_group, subrec->subnet_name)); work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE; return; } @@ -346,11 +344,11 @@ workgroup %s on subnet %s\n", registered_name->name, subrec->subnet_name)); return; } - if((servrec = find_server_in_workgroup( work, global_myname)) == NULL) + if((servrec = find_server_in_workgroup( work, global_myname())) == NULL) { DEBUG(0,("become_local_master_stage2: Error - cannot find server %s \ in workgroup %s on subnet %s\n", - global_myname, registered_name->name, subrec->subnet_name)); + global_myname(), registered_name->name, subrec->subnet_name)); work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE; return; } @@ -368,7 +366,7 @@ on subnet %s\n", work->work_group, subrec->subnet_name)); subrec->work_changed = True; /* Add this name to the workgroup as local master browser. */ - set_workgroup_local_master_browser_name( work, global_myname); + set_workgroup_local_master_browser_name( work, global_myname()); /* Count the number of servers we have on our list. If it's less than 10 (just a heuristic) request the servers @@ -403,7 +401,7 @@ on subnet %s\n", work->work_group, subrec->subnet_name)); if( DEBUGLVL( 0 ) ) { dbgtext( "*****\n\n" ); - dbgtext( "Samba name server %s ", global_myname ); + dbgtext( "Samba name server %s ", global_myname() ); dbgtext( "is now a local master browser " ); dbgtext( "for workgroup %s ", work->work_group ); dbgtext( "on subnet %s\n\n*****\n", subrec->subnet_name ); @@ -493,11 +491,11 @@ workgroup %s on subnet %s\n", work_name, subrec->subnet_name)); return; } - if(find_server_in_workgroup(work, global_myname) == NULL) + if(find_server_in_workgroup(work, global_myname()) == NULL) { DEBUG(0,("become_local_master_fail1: Error - cannot find server %s \ in workgroup %s on subnet %s\n", - global_myname, work->work_group, subrec->subnet_name)); + global_myname(), work->work_group, subrec->subnet_name)); return; } @@ -536,11 +534,11 @@ void become_local_master_browser(struct subnet_record *subrec, struct work_recor return; } - if(find_server_in_workgroup( work, global_myname) == NULL) + if(find_server_in_workgroup( work, global_myname()) == NULL) { DEBUG(0,("become_local_master_browser: Error - cannot find server %s \ in workgroup %s on subnet %s\n", - global_myname, work->work_group, subrec->subnet_name)); + global_myname(), work->work_group, subrec->subnet_name)); return; } @@ -583,7 +581,7 @@ in workgroup %s on subnet %s\n", as the workgroup name. ****************************************************************/ -void set_workgroup_local_master_browser_name( struct work_record *work, char *newname) +void set_workgroup_local_master_browser_name( struct work_record *work, const char *newname) { DEBUG(5,("set_workgroup_local_master_browser_name: setting local master name to '%s' \ for workgroup %s.\n", newname, work->work_group )); diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c index 5dcc8cce196..3a20f07b052 100644 --- a/source3/nmbd/nmbd_browsesync.c +++ b/source3/nmbd/nmbd_browsesync.c @@ -24,9 +24,6 @@ #include "includes.h" #include "smb.h" -extern pstring global_myname; -extern fstring global_myworkgroup; - /* This is our local master browser list database. */ extern ubi_dlList lmb_browserlist[]; @@ -129,7 +126,7 @@ static void announce_local_master_browser_to_domain_master_browser( struct work_ SCVAL(p,0,ANN_MasterAnnouncement); p++; - StrnCpy(p,global_myname,15); + StrnCpy(p,global_myname(),15); strupper(p); p = skip_string(p,1); @@ -142,7 +139,7 @@ static void announce_local_master_browser_to_domain_master_browser( struct work_ } send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf), - global_myname, 0x0, work->dmb_name.name, 0x0, + global_myname(), 0x0, work->dmb_name.name, 0x0, work->dmb_addr, FIRST_SUBNET->myip, DGRAM_PORT); } @@ -611,12 +608,12 @@ void collect_all_workgroup_names_from_wins_server(time_t t) return; /* Check to see if we are a domain master browser on the unicast subnet. */ - if((work = find_workgroup_on_subnet( unicast_subnet, global_myworkgroup)) == NULL) + if((work = find_workgroup_on_subnet( unicast_subnet, lp_workgroup())) == NULL) { if( DEBUGLVL( 0 ) ) { dbgtext( "collect_all_workgroup_names_from_wins_server:\n" ); - dbgtext( "Cannot find my workgroup %s ", global_myworkgroup ); + dbgtext( "Cannot find my workgroup %s ", lp_workgroup() ); dbgtext( "on subnet %s.\n", unicast_subnet->subnet_name ); } return; @@ -660,7 +657,7 @@ void sync_all_dmbs(time_t t) /* Check to see if we are a domain master browser on the unicast subnet. */ - work = find_workgroup_on_subnet(unicast_subnet, global_myworkgroup); + work = find_workgroup_on_subnet(unicast_subnet, lp_workgroup()); if (!work) return; if (!AM_DOMAIN_MASTER_BROWSER(work)) @@ -671,14 +668,14 @@ void sync_all_dmbs(time_t t) /* count how many syncs we might need to do */ for (work=unicast_subnet->workgrouplist; work; work = work->next) { - if (strcmp(global_myworkgroup, work->work_group)) { + if (strcmp(lp_workgroup(), work->work_group)) { count++; } } /* sync with a probability of 1/count */ for (work=unicast_subnet->workgrouplist; work; work = work->next) { - if (strcmp(global_myworkgroup, work->work_group)) { + if (strcmp(lp_workgroup(), work->work_group)) { if (((unsigned)sys_random()) % count != 0) continue; lastrun = t; diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c index acff7a72e80..976abbed257 100644 --- a/source3/nmbd/nmbd_elections.c +++ b/source3/nmbd/nmbd_elections.c @@ -23,17 +23,14 @@ #include "includes.h" -extern pstring global_myname; -extern fstring global_myworkgroup; - /* Election parameters. */ extern time_t StartupTime; /**************************************************************************** Send an election datagram packet. **************************************************************************/ -static void send_election_dgram(struct subnet_record *subrec, char *workgroup_name, - uint32 criterion, int timeup,char *server_name) +static void send_election_dgram(struct subnet_record *subrec, const char *workgroup_name, + uint32 criterion, int timeup,const char *server_name) { pstring outbuf; char *p; @@ -55,7 +52,7 @@ static void send_election_dgram(struct subnet_record *subrec, char *workgroup_na p = skip_string(p,1); send_mailslot(False, BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf), - global_myname, 0, + global_myname(), 0, workgroup_name, 0x1e, subrec->bcast_ip, subrec->myip, DGRAM_PORT); } @@ -92,7 +89,7 @@ static void check_for_master_browser_fail( struct subnet_record *subrec, return; } - if (strequal(work->work_group, global_myworkgroup)) + if (strequal(work->work_group, lp_workgroup())) { if (lp_local_master()) @@ -128,7 +125,7 @@ void check_master_browser_exists(time_t t) { static time_t lastrun=0; struct subnet_record *subrec; - char *workgroup_name = global_myworkgroup; + const char *workgroup_name = lp_workgroup(); if (!lastrun) lastrun = t; @@ -198,7 +195,7 @@ yet registered on subnet %s\n", nmb_namestr(&nmbname), subrec->subnet_name )); } send_election_dgram(subrec, work->work_group, work->ElectionCriterion, - t - StartupTime, global_myname); + t - StartupTime, global_myname()); if (work->ElectionCount++ >= 4) { @@ -238,7 +235,7 @@ static BOOL win_election(struct work_record *work, int version, version, ELECTION_VERSION, criterion, mycriterion, timeup, mytimeup, - server_name, global_myname)); + server_name, global_myname())); if (version > ELECTION_VERSION) return(False); @@ -255,7 +252,7 @@ static BOOL win_election(struct work_record *work, int version, if (timeup < mytimeup) return(True); - if (strcasecmp(global_myname, server_name) > 0) + if (strcasecmp(global_myname(), server_name) > 0) return(False); return(True); @@ -290,7 +287,7 @@ void process_election(struct subnet_record *subrec, struct packet_struct *p, cha goto done; } - if (!strequal(work->work_group, global_myworkgroup)) + if (!strequal(work->work_group, lp_workgroup())) { DEBUG(3,("process_election: ignoring election request for workgroup %s on subnet %s as this \ is not my workgroup.\n", work->work_group, subrec->subnet_name )); @@ -396,7 +393,7 @@ void nmbd_message_election(int msg_type, pid_t src, void *buf, size_t len) for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) { struct work_record *work; for (work = subrec->workgrouplist; work; work = work->next) { - if (strequal(work->work_group, global_myworkgroup)) { + if (strequal(work->work_group, lp_workgroup())) { work->needelection = True; work->ElectionCount=0; work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE; diff --git a/source3/nmbd/nmbd_incomingdgrams.c b/source3/nmbd/nmbd_incomingdgrams.c index 261200b4c52..cd6954fc62a 100644 --- a/source3/nmbd/nmbd_incomingdgrams.c +++ b/source3/nmbd/nmbd_incomingdgrams.c @@ -23,8 +23,6 @@ #include "includes.h" -extern pstring global_myname; -extern fstring global_myworkgroup; extern BOOL found_lm_clients; #if 0 @@ -104,7 +102,7 @@ void process_host_announce(struct subnet_record *subrec, struct packet_struct *p char *comment = buf+31; struct work_record *work; struct server_record *servrec; - char *work_name; + const char *work_name; char *source_name = dgram->source_name.name; START_PROFILE(host_announce); @@ -141,8 +139,8 @@ void process_host_announce(struct subnet_record *subrec, struct packet_struct *p * to be our primary workgroup name. */ - if(strequal(work_name, global_myname)) - work_name = global_myworkgroup; + if(strequal(work_name, global_myname())) + work_name = lp_workgroup(); /* * We are being very agressive here in adding a workgroup @@ -396,10 +394,10 @@ master - ignoring master announce.\n")); goto done; } - if((work = find_workgroup_on_subnet(subrec, global_myworkgroup)) == NULL) + if((work = find_workgroup_on_subnet(subrec, lp_workgroup())) == NULL) { DEBUG(0,("process_master_browser_announce: Cannot find workgroup %s on subnet %s\n", - global_myworkgroup, subrec->subnet_name)); + lp_workgroup(), subrec->subnet_name)); goto done; } @@ -439,7 +437,7 @@ void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct char *announce_name = buf+9; struct work_record *work; struct server_record *servrec; - char *work_name; + const char *work_name; char *source_name = dgram->source_name.name; pstring comment; char *s = buf+9; @@ -489,8 +487,8 @@ originate from OS/2 Warp client. Ignoring packet.\n")); * not needed in the LanMan announce code, but it won't hurt. */ - if(strequal(work_name, global_myname)) - work_name = global_myworkgroup; + if(strequal(work_name, global_myname())) + work_name = lp_workgroup(); /* * We are being very agressive here in adding a workgroup @@ -580,7 +578,7 @@ static void send_backup_list_response(struct subnet_record *subrec, /* We always return at least one name - our own. */ count = 1; - StrnCpy(p,global_myname,15); + StrnCpy(p,global_myname(),15); strupper(p); p = skip_string(p,1); @@ -605,7 +603,7 @@ static void send_backup_list_response(struct subnet_record *subrec, if(count >= (unsigned int)max_number_requested) break; - if(strnequal(servrec->serv.name, global_myname,15)) + if(strnequal(servrec->serv.name, global_myname(),15)) continue; if(!(servrec->serv.type & SV_TYPE_BACKUP_BROWSER)) @@ -629,7 +627,7 @@ static void send_backup_list_response(struct subnet_record *subrec, send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf), - global_myname, 0, + global_myname(), 0, send_to_name->name,0, sendto_ip, subrec->myip, port); } @@ -664,7 +662,7 @@ void process_get_backup_list_request(struct subnet_record *subrec, for the requested workgroup. That means it must be our workgroup. */ - if(strequal(workgroup_name, global_myworkgroup) == False) + if(strequal(workgroup_name, lp_workgroup()) == False) { DEBUG(7,("process_get_backup_list_request: Ignoring announce request for workgroup %s.\n", workgroup_name)); @@ -801,7 +799,7 @@ void process_announce_request(struct subnet_record *subrec, struct packet_struct nmb_namestr(&dgram->dest_name))); /* We only send announcement requests on our workgroup. */ - if(strequal(workgroup_name, global_myworkgroup) == False) + if(strequal(workgroup_name, lp_workgroup()) == False) { DEBUG(7,("process_announce_request: Ignoring announce request for workgroup %s.\n", workgroup_name)); @@ -840,7 +838,7 @@ void process_lm_announce_request(struct subnet_record *subrec, struct packet_str nmb_namestr(&dgram->dest_name))); /* We only send announcement requests on our workgroup. */ - if(strequal(workgroup_name, global_myworkgroup) == False) + if(strequal(workgroup_name, lp_workgroup()) == False) { DEBUG(7,("process_lm_announce_request: Ignoring announce request for workgroup %s.\n", workgroup_name)); diff --git a/source3/nmbd/nmbd_incomingrequests.c b/source3/nmbd/nmbd_incomingrequests.c index 834f237a2c2..a8168566f1f 100644 --- a/source3/nmbd/nmbd_incomingrequests.c +++ b/source3/nmbd/nmbd_incomingrequests.c @@ -27,8 +27,6 @@ #include "includes.h" -extern fstring global_myworkgroup; - /**************************************************************************** Send a name release response. **************************************************************************/ @@ -100,7 +98,7 @@ subnet %s from owner IP %s\n", * names and *don't set the group bit* !!!!! */ - if( !group && !ismyip(owner_ip) && strequal(question->name, global_myworkgroup) && + if( !group && !ismyip(owner_ip) && strequal(question->name, lp_workgroup()) && ((question->name_type == 0x0) || (question->name_type == 0x1e))) { DEBUG(6,("process_name_release_request: FTP OnNet bug workaround. Ignoring \ @@ -292,20 +290,19 @@ We put our own names first, then in alphabetical order. static int status_compare(char *n1,char *n2) { - extern pstring global_myname; int l1,l2,l3; /* It's a bit tricky because the names are space padded */ for (l1=0;l1<15 && n1[l1] && n1[l1] != ' ';l1++) ; for (l2=0;l2<15 && n2[l2] && n2[l2] != ' ';l2++) ; - l3 = strlen(global_myname); + l3 = strlen(global_myname()); - if ((l1==l3) && strncmp(n1,global_myname,l3) == 0 && - (l2!=l3 || strncmp(n2,global_myname,l3) != 0)) + if ((l1==l3) && strncmp(n1,global_myname(),l3) == 0 && + (l2!=l3 || strncmp(n2,global_myname(),l3) != 0)) return -1; - if ((l2==l3) && strncmp(n2,global_myname,l3) == 0 && - (l1!=l3 || strncmp(n1,global_myname,l3) != 0)) + if ((l2==l3) && strncmp(n2,global_myname(),l3) == 0 && + (l1!=l3 || strncmp(n1,global_myname(),l3) != 0)) return 1; return memcmp(n1,n2,18); diff --git a/source3/nmbd/nmbd_logonnames.c b/source3/nmbd/nmbd_logonnames.c index 28e0e8a02ba..b73586aa453 100644 --- a/source3/nmbd/nmbd_logonnames.c +++ b/source3/nmbd/nmbd_logonnames.c @@ -23,9 +23,6 @@ #include "includes.h" -extern pstring global_myname; -extern fstring global_myworkgroup; -extern char **my_netbios_names; extern struct in_addr allones_ip; extern uint16 samba_nb_type; /* Samba's NetBIOS type. */ @@ -47,11 +44,11 @@ workgroup %s on subnet %s\n", fail_name->name, subrec->subnet_name)); return; } - if((servrec = find_server_in_workgroup( work, global_myname)) == NULL) + if((servrec = find_server_in_workgroup( work, global_myname())) == NULL) { DEBUG(0,("become_logon_server_fail: Error - cannot find server %s \ in workgroup %s on subnet %s\n", - global_myname, fail_name->name, subrec->subnet_name)); + global_myname(), fail_name->name, subrec->subnet_name)); work->log_state = LOGON_NONE; return; } @@ -87,11 +84,11 @@ workgroup %s on subnet %s\n", registered_name->name, subrec->subnet_name)); return; } - if((servrec = find_server_in_workgroup( work, global_myname)) == NULL) + if((servrec = find_server_in_workgroup( work, global_myname())) == NULL) { DEBUG(0,("become_logon_server_success: Error - cannot find server %s \ in workgroup %s on subnet %s\n", - global_myname, registered_name->name, subrec->subnet_name)); + global_myname(), registered_name->name, subrec->subnet_name)); work->log_state = LOGON_NONE; return; } @@ -115,7 +112,7 @@ in workgroup %s on subnet %s\n", */ { struct nmb_name nmbname; - make_nmb_name(&nmbname,global_myworkgroup,0x1c); + make_nmb_name(&nmbname,lp_workgroup(),0x1c); insert_permanent_name_into_unicast(subrec, &nmbname, 0x1c); } @@ -152,12 +149,12 @@ void add_logon_names(void) for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec)) { - struct work_record *work = find_workgroup_on_subnet(subrec, global_myworkgroup); + struct work_record *work = find_workgroup_on_subnet(subrec, lp_workgroup()); if (work && (work->log_state == LOGON_NONE)) { struct nmb_name nmbname; - make_nmb_name(&nmbname,global_myworkgroup,0x1c); + make_nmb_name(&nmbname,lp_workgroup(),0x1c); if (find_name_on_subnet(subrec, &nmbname, FIND_SELF_NAME) == NULL) { @@ -165,7 +162,7 @@ void add_logon_names(void) { dbgtext( "add_domain_logon_names:\n" ); dbgtext( "Attempting to become logon server " ); - dbgtext( "for workgroup %s ", global_myworkgroup ); + dbgtext( "for workgroup %s ", lp_workgroup() ); dbgtext( "on subnet %s\n", subrec->subnet_name ); } become_logon_server(subrec, work); diff --git a/source3/nmbd/nmbd_mynames.c b/source3/nmbd/nmbd_mynames.c index ba7d509a77f..dd668218395 100644 --- a/source3/nmbd/nmbd_mynames.c +++ b/source3/nmbd/nmbd_mynames.c @@ -23,9 +23,6 @@ #include "includes.h" -extern char **my_netbios_names; -extern fstring global_myworkgroup; - extern uint16 samba_nb_type; /* Samba's NetBIOS type. */ /**************************************************************************** @@ -51,10 +48,10 @@ void register_my_workgroup_one_subnet(struct subnet_record *subrec) struct work_record *work; /* Create the workgroup on the subnet. */ - if((work = create_workgroup_on_subnet(subrec, global_myworkgroup, + if((work = create_workgroup_on_subnet(subrec, lp_workgroup(), PERMANENT_TTL)) == NULL) { DEBUG(0,("register_my_workgroup_and_names: Failed to create my workgroup %s on subnet %s. \ -Exiting.\n", global_myworkgroup, subrec->subnet_name)); +Exiting.\n", lp_workgroup(), subrec->subnet_name)); return; } @@ -63,14 +60,14 @@ Exiting.\n", global_myworkgroup, subrec->subnet_name)); add_samba_names_to_subnet(subrec); /* Register all our names including aliases. */ - for (i=0; my_netbios_names[i]; i++) { - register_name(subrec, my_netbios_names[i],0x20,samba_nb_type, + for (i=0; my_netbios_names(i); i++) { + register_name(subrec, my_netbios_names(i),0x20,samba_nb_type, NULL, my_name_register_failed, NULL); - register_name(subrec, my_netbios_names[i],0x03,samba_nb_type, + register_name(subrec, my_netbios_names(i),0x03,samba_nb_type, NULL, my_name_register_failed, NULL); - register_name(subrec, my_netbios_names[i],0x00,samba_nb_type, + register_name(subrec, my_netbios_names(i),0x00,samba_nb_type, NULL, my_name_register_failed, NULL); } @@ -133,7 +130,7 @@ BOOL register_my_workgroup_and_names(void) add_samba_names_to_subnet(unicast_subnet); - for (i=0; my_netbios_names[i]; i++) + for (i=0; my_netbios_names(i); i++) { for(subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) { @@ -142,13 +139,13 @@ BOOL register_my_workgroup_and_names(void) */ struct nmb_name nmbname; - make_nmb_name(&nmbname, my_netbios_names[i],0x20); + make_nmb_name(&nmbname, my_netbios_names(i),0x20); insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type); - make_nmb_name(&nmbname, my_netbios_names[i],0x3); + make_nmb_name(&nmbname, my_netbios_names(i),0x3); insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type); - make_nmb_name(&nmbname, my_netbios_names[i],0x0); + make_nmb_name(&nmbname, my_netbios_names(i),0x0); insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type); } } @@ -165,10 +162,10 @@ BOOL register_my_workgroup_and_names(void) */ struct nmb_name nmbname; - make_nmb_name(&nmbname, global_myworkgroup, 0x0); + make_nmb_name(&nmbname, lp_workgroup(), 0x0); insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP); - make_nmb_name(&nmbname, global_myworkgroup, 0x1e); + make_nmb_name(&nmbname, lp_workgroup(), 0x1e); insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP); } diff --git a/source3/nmbd/nmbd_namelistdb.c b/source3/nmbd/nmbd_namelistdb.c index bca79ef0c80..7ff2d4171e9 100644 --- a/source3/nmbd/nmbd_namelistdb.c +++ b/source3/nmbd/nmbd_namelistdb.c @@ -23,8 +23,6 @@ #include "includes.h" -extern char **my_netbios_names; - uint16 samba_nb_type = 0; /* samba's NetBIOS name type */ @@ -215,7 +213,7 @@ struct name_record *add_name_to_subnet( struct subnet_record *subrec, namerec->data.wins_flags = WINS_ACTIVE; /* If it's our primary name, flag it as so. */ - if( strequal( my_netbios_names[0], name ) ) + if( strequal( my_netbios_names(0), name ) ) namerec->data.nb_flags |= NB_PERM; /* Copy the IPs. */ diff --git a/source3/nmbd/nmbd_nameregister.c b/source3/nmbd/nmbd_nameregister.c index b6d3c20d995..7bf2584053f 100644 --- a/source3/nmbd/nmbd_nameregister.c +++ b/source3/nmbd/nmbd_nameregister.c @@ -23,8 +23,6 @@ #include "includes.h" -extern fstring global_myworkgroup; - /* forward declarations */ static void wins_next_registration(struct response_record *rrec); @@ -87,7 +85,7 @@ static void register_name_response(struct subnet_record *subrec, */ #if 1 /* OLD_SAMBA_SERVER_HACK */ - if((nmb->header.rcode == ACT_ERR) && strequal(global_myworkgroup, answer_name->name) && + if((nmb->header.rcode == ACT_ERR) && strequal(lp_workgroup(), answer_name->name) && (answer_name->name_type == 0x1b)) { /* Pretend we did not get this. */ rrec->num_msgs--; @@ -463,7 +461,7 @@ static void multihomed_register_name(struct nmb_name *nmbname, uint16 nb_flags, Try and register one of our names. ****************************************************************************/ void register_name(struct subnet_record *subrec, - char *name, int type, uint16 nb_flags, + const char *name, int type, uint16 nb_flags, register_name_success_function success_fn, register_name_fail_function fail_fn, struct userdata_struct *userdata) diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index d252b98ed69..894f6bb7d6d 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1080,15 +1080,14 @@ static void process_browse_packet(struct packet_struct *p, char *buf,int len) struct dgram_packet *dgram = &p->packet.dgram; int command = CVAL(buf,0); struct subnet_record *subrec = find_subnet_for_dgram_browse_packet(p); - extern pstring global_scope; /* Drop the packet if it's a different NetBIOS scope, or the source is from one of our names. */ - if (!strequal(dgram->dest_name.scope, global_scope)) + if (!strequal(dgram->dest_name.scope, global_scope())) { DEBUG(7,("process_browse_packet: Discarding datagram from IP %s. Scope (%s) \ -mismatch with our scope (%s).\n", inet_ntoa(p->ip), dgram->dest_name.scope, global_scope)); +mismatch with our scope (%s).\n", inet_ntoa(p->ip), dgram->dest_name.scope, global_scope())); return; } @@ -1193,15 +1192,14 @@ static void process_lanman_packet(struct packet_struct *p, char *buf,int len) struct dgram_packet *dgram = &p->packet.dgram; int command = SVAL(buf,0); struct subnet_record *subrec = find_subnet_for_dgram_browse_packet(p); - extern pstring global_scope; /* Drop the packet if it's a different NetBIOS scope, or the source is from one of our names. */ - if (!strequal(dgram->dest_name.scope, global_scope)) + if (!strequal(dgram->dest_name.scope, global_scope())) { DEBUG(7,("process_lanman_packet: Discarding datagram from IP %s. Scope (%s) \ -mismatch with our scope (%s).\n", inet_ntoa(p->ip), dgram->dest_name.scope, global_scope)); +mismatch with our scope (%s).\n", inet_ntoa(p->ip), dgram->dest_name.scope, global_scope())); return; } @@ -1932,8 +1930,8 @@ BOOL listen_for_packets(BOOL run_election) Construct and send a netbios DGRAM. **************************************************************************/ BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len, - char *srcname, int src_type, - char *dstname, int dest_type, + const char *srcname, int src_type, + const char *dstname, int dest_type, struct in_addr dest_ip,struct in_addr src_ip, int dest_port) { diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c index b65cebe2035..6f2517f39f4 100644 --- a/source3/nmbd/nmbd_processlogon.c +++ b/source3/nmbd/nmbd_processlogon.c @@ -27,9 +27,6 @@ #include "includes.h" -extern pstring global_myname; -extern fstring global_myworkgroup; - struct sam_database_info { uint32 index; uint32 serial_lo, serial_hi; @@ -93,8 +90,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) )); return; } - pstrcpy(my_name, global_myname); - strupper(my_name); + pstrcpy(my_name, global_myname()); code = SVAL(buf,0); DEBUG(1,("process_logon_packet: Logon from %s: code = 0x%x\n", inet_ntoa(p->ip), code)); @@ -131,7 +127,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) )); send_mailslot(True, getdc, outbuf,PTR_DIFF(q,outbuf), - global_myname, 0x0, + global_myname(), 0x0, machine, dgram->source_name.name_type, p->ip, *iface_ip(p->ip), p->port); @@ -198,7 +194,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) )); q = ALIGN2(q, outbuf); q += dos_PutUniCode(q, my_name, sizeof(pstring), True); /* PDC name */ - q += dos_PutUniCode(q, global_myworkgroup,sizeof(pstring), True); /* Domain name*/ + q += dos_PutUniCode(q, lp_workgroup(),sizeof(pstring), True); /* Domain name*/ SIVAL(q, 0, 1); /* our nt version */ SSVAL(q, 4, 0xffff); /* our lmnttoken */ SSVAL(q, 6, 0xffff); /* our lm20token */ @@ -209,7 +205,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) )); DEBUG(3,("process_logon_packet: GETDC request from %s at IP %s, \ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", - machine,inet_ntoa(p->ip), reply_name, global_myworkgroup, + machine,inet_ntoa(p->ip), reply_name, lp_workgroup(), QUERYFORPDC_R, (uint32)ntversion, (uint32)lmnttoken, (uint32)lm20token )); @@ -217,7 +213,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", send_mailslot(True, getdc, outbuf,PTR_DIFF(q,outbuf), - global_myname, 0x0, + global_myname(), 0x0, dgram->source_name.name, dgram->source_name.name_type, p->ip, *iface_ip(p->ip), p->port); @@ -280,7 +276,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", fstrcpy(reply_name+2,my_name); DEBUG(3,("process_logon_packet: SAMLOGON request from %s(%s) for %s, returning logon svr %s domain %s code %x token=%x\n", - asccomp,inet_ntoa(p->ip), ascuser, reply_name, global_myworkgroup, + asccomp,inet_ntoa(p->ip), ascuser, reply_name, lp_workgroup(), SAMLOGON_R ,lmnttoken)); /* Construct reply. */ @@ -299,7 +295,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", q += dos_PutUniCode(q, reply_name,sizeof(pstring), True); q += dos_PutUniCode(q, ascuser, sizeof(pstring), True); - q += dos_PutUniCode(q, global_myworkgroup,sizeof(pstring), True); + q += dos_PutUniCode(q, lp_workgroup(),sizeof(pstring), True); } #ifdef HAVE_ADS else { @@ -345,7 +341,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", q += 2; /* it must follow the domain name. */ /* Push dns host name */ - size = push_ascii(&q[1], global_myname, -1, 0); + size = push_ascii(&q[1], global_myname(), -1, 0); SCVAL(q, 0, size); q += (size + 1); SSVAL(q, 0, 0x18c0); /* not sure what this is for, but */ @@ -397,7 +393,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", send_mailslot(True, getdc, outbuf,PTR_DIFF(q,outbuf), - global_myname, 0x0, + global_myname(), 0x0, dgram->source_name.name, dgram->source_name.name_type, p->ip, *iface_ip(p->ip), p->port); diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c index d4a70700427..de05ee973ce 100644 --- a/source3/nmbd/nmbd_sendannounce.c +++ b/source3/nmbd/nmbd_sendannounce.c @@ -26,9 +26,6 @@ #include "includes.h" -extern pstring global_myname; -extern fstring global_myworkgroup; -extern char **my_netbios_names; extern int updatecount; extern BOOL found_lm_clients; @@ -52,7 +49,7 @@ void send_browser_reset(int reset_type, char *to_name, int to_type, struct in_ad p++; send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf), - global_myname, 0x0, to_name, to_type, to_ip, + global_myname(), 0x0, to_name, to_type, to_ip, FIRST_SUBNET->myip, DGRAM_PORT); } @@ -78,10 +75,10 @@ to subnet %s\n", work->work_group, subrec->subnet_name)); SCVAL(p,0,work->token); /* (local) Unique workgroup token id. */ p++; - p += push_string(NULL, p+1, global_myname, 15, STR_ASCII|STR_UPPER|STR_TERMINATE); + p += push_string(NULL, p+1, global_myname(), 15, STR_ASCII|STR_UPPER|STR_TERMINATE); send_mailslot(False, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf), - global_myname, 0x0, work->work_group,0x1e, subrec->bcast_ip, + global_myname(), 0x0, work->work_group,0x1e, subrec->bcast_ip, subrec->myip, DGRAM_PORT); } @@ -90,9 +87,9 @@ to subnet %s\n", work->work_group, subrec->subnet_name)); **************************************************************************/ static void send_announcement(struct subnet_record *subrec, int announce_type, - char *from_name, char *to_name, int to_type, struct in_addr to_ip, + const char *from_name, const char *to_name, int to_type, struct in_addr to_ip, time_t announce_interval, - char *server_name, int server_type, char *server_comment) + const char *server_name, int server_type, const char *server_comment) { pstring outbuf; char *p; @@ -168,14 +165,14 @@ static void send_local_master_announcement(struct subnet_record *subrec, struct uint32 type = servrec->serv.type & ~SV_TYPE_LOCAL_LIST_ONLY; DEBUG(3,("send_local_master_announcement: type %x for name %s on subnet %s for workgroup %s\n", - type, global_myname, subrec->subnet_name, work->work_group)); + type, global_myname(), subrec->subnet_name, work->work_group)); send_announcement(subrec, ANN_LocalMasterAnnouncement, - global_myname, /* From nbt name. */ + global_myname(), /* From nbt name. */ work->work_group, 0x1e, /* To nbt name. */ subrec->bcast_ip, /* To ip. */ work->announce_interval, /* Time until next announce. */ - global_myname, /* Name to announce. */ + global_myname(), /* Name to announce. */ type, /* Type field. */ servrec->serv.comment); } @@ -190,13 +187,13 @@ static void send_workgroup_announcement(struct subnet_record *subrec, struct wor subrec->subnet_name, work->work_group)); send_announcement(subrec, ANN_DomainAnnouncement, - global_myname, /* From nbt name. */ + global_myname(), /* From nbt name. */ MSBROWSE, 0x1, /* To nbt name. */ subrec->bcast_ip, /* To ip. */ work->announce_interval, /* Time until next announce. */ work->work_group, /* Name to announce. */ SV_TYPE_DOMAIN_ENUM|SV_TYPE_NT, /* workgroup announce flags. */ - global_myname); /* From name as comment. */ + global_myname()); /* From name as comment. */ } /**************************************************************************** @@ -255,7 +252,7 @@ static void announce_server(struct subnet_record *subrec, struct work_record *wo /* Only do domain announcements if we are a master and it's our primary name we're being asked to announce. */ - if (AM_LOCAL_MASTER_BROWSER(work) && strequal(global_myname,servrec->serv.name)) + if (AM_LOCAL_MASTER_BROWSER(work) && strequal(global_myname(),servrec->serv.name)) { send_local_master_announcement(subrec, work, servrec); send_workgroup_announcement(subrec, work); @@ -277,7 +274,7 @@ void announce_my_server_names(time_t t) for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) { - struct work_record *work = find_workgroup_on_subnet(subrec, global_myworkgroup); + struct work_record *work = find_workgroup_on_subnet(subrec, lp_workgroup()); if(work) { @@ -341,7 +338,7 @@ void announce_my_lm_server_names(time_t t) for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) { - struct work_record *work = find_workgroup_on_subnet(subrec, global_myworkgroup); + struct work_record *work = find_workgroup_on_subnet(subrec, lp_workgroup()); if(work) { @@ -483,7 +480,8 @@ void announce_my_servers_removed(void) void announce_remote(time_t t) { - char *s,*ptr; + char *s; + const char *ptr; static time_t last_time = 0; pstring s2; struct in_addr addr; @@ -505,14 +503,17 @@ void announce_remote(time_t t) { /* The entries are of the form a.b.c.d/WORKGROUP with WORKGROUP being optional */ - char *wgroup; + const char *wgroup; + char *pwgroup; int i; - wgroup = strchr_m(s2,'/'); - if (wgroup) - *wgroup++ = 0; - if (!wgroup || !*wgroup) - wgroup = global_myworkgroup; + pwgroup = strchr_m(s2,'/'); + if (pwgroup) + *pwgroup++ = 0; + if (!pwgroup || !*pwgroup) + wgroup = lp_workgroup(); + else + wgroup = pwgroup; addr = *interpret_addr2(s2); @@ -520,9 +521,9 @@ void announce_remote(time_t t) /* Give the ip address as the address of our first broadcast subnet. */ - for(i=0; my_netbios_names[i]; i++) + for(i=0; my_netbios_names(i); i++) { - char *name = my_netbios_names[i]; + const char *name = my_netbios_names(i); DEBUG(5,("announce_remote: Doing remote announce for server %s to IP %s.\n", name, inet_ntoa(addr) )); @@ -546,7 +547,8 @@ void announce_remote(time_t t) void browse_sync_remote(time_t t) { - char *s,*ptr; + char *s; + const char *ptr; static time_t last_time = 0; pstring s2; struct in_addr addr; @@ -568,17 +570,17 @@ void browse_sync_remote(time_t t) * for our workgroup on the firsst subnet. */ - if((work = find_workgroup_on_subnet(FIRST_SUBNET, global_myworkgroup)) == NULL) + if((work = find_workgroup_on_subnet(FIRST_SUBNET, lp_workgroup())) == NULL) { DEBUG(0,("browse_sync_remote: Cannot find workgroup %s on subnet %s\n", - global_myworkgroup, FIRST_SUBNET->subnet_name )); + lp_workgroup(), FIRST_SUBNET->subnet_name )); return; } if(!AM_LOCAL_MASTER_BROWSER(work)) { DEBUG(5,("browse_sync_remote: We can only do this if we are a local master browser \ -for workgroup %s on subnet %s.\n", global_myworkgroup, FIRST_SUBNET->subnet_name )); +for workgroup %s on subnet %s.\n", lp_workgroup(), FIRST_SUBNET->subnet_name )); return; } @@ -587,7 +589,7 @@ for workgroup %s on subnet %s.\n", global_myworkgroup, FIRST_SUBNET->subnet_name SCVAL(p,0,ANN_MasterAnnouncement); p++; - StrnCpy(p,global_myname,15); + StrnCpy(p,global_myname(),15); strupper(p); p = skip_string(p,1); @@ -597,9 +599,9 @@ for workgroup %s on subnet %s.\n", global_myworkgroup, FIRST_SUBNET->subnet_name addr = *interpret_addr2(s2); DEBUG(5,("announce_remote: Doing remote browse sync announce for server %s to IP %s.\n", - global_myname, inet_ntoa(addr) )); + global_myname(), inet_ntoa(addr) )); send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf), - global_myname, 0x0, "*", 0x0, addr, FIRST_SUBNET->myip, DGRAM_PORT); + global_myname(), 0x0, "*", 0x0, addr, FIRST_SUBNET->myip, DGRAM_PORT); } } diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c index a315d80afe6..2fee239b2dc 100644 --- a/source3/nmbd/nmbd_serverlistdb.c +++ b/source3/nmbd/nmbd_serverlistdb.c @@ -26,9 +26,6 @@ extern int ClientNMB; -extern fstring global_myworkgroup; -extern char **my_netbios_names; - int updatecount = 0; /******************************************************************* @@ -91,7 +88,7 @@ static void add_server_to_workgroup(struct work_record *work, Find a server in a server list. **************************************************************************/ -struct server_record *find_server_in_workgroup(struct work_record *work, char *name) +struct server_record *find_server_in_workgroup(struct work_record *work, const char *name) { struct server_record *ret; @@ -128,8 +125,8 @@ void remove_server_from_workgroup(struct work_record *work, struct server_record ****************************************************************************/ struct server_record *create_server_on_workgroup(struct work_record *work, - char *name,int servertype, - int ttl,char *comment) + const char *name,int servertype, + int ttl, const char *comment) { struct server_record *servrec; @@ -256,7 +253,7 @@ static uint32 write_this_server_name( struct subnet_record *subrec, /******************************************************************* Decide if we should write out a workgroup record for this workgroup. - We return zero if we should not. Don't write out global_myworkgroup (we've + We return zero if we should not. Don't write out lp_workgroup() (we've already done it) and also don't write out a second workgroup record on the unicast subnet that we've already written out on one of the broadcast subnets. @@ -267,7 +264,7 @@ static uint32 write_this_workgroup_name( struct subnet_record *subrec, { struct subnet_record *ssub; - if(strequal(global_myworkgroup, work->work_group)) + if(strequal(lp_workgroup(), work->work_group)) return 0; /* This is a workgroup we have seen on a broadcast subnet. All @@ -295,8 +292,8 @@ static uint32 write_this_workgroup_name( struct subnet_record *subrec, Write out the browse.dat file. ******************************************************************/ -void write_browse_list_entry(XFILE *fp, fstring name, uint32 rec_type, - fstring local_master_browser_name, fstring description) +void write_browse_list_entry(XFILE *fp, const char *name, uint32 rec_type, + const char *local_master_browser_name, const char *description) { fstring tmp; @@ -368,10 +365,10 @@ void write_browse_list(time_t t, BOOL force_write) * subnet. */ - if((work = find_workgroup_on_subnet(FIRST_SUBNET, global_myworkgroup)) == NULL) + if((work = find_workgroup_on_subnet(FIRST_SUBNET, lp_workgroup())) == NULL) { DEBUG(0,("write_browse_list: Fatal error - cannot find my workgroup %s\n", - global_myworkgroup)); + lp_workgroup())); x_fclose(fp); return; } @@ -388,22 +385,22 @@ void write_browse_list(time_t t, BOOL force_write) * once. */ - for (i=0; my_netbios_names[i]; i++) + for (i=0; my_netbios_names(i); i++) { stype = 0; for (subrec = FIRST_SUBNET; subrec ; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec)) { - if((work = find_workgroup_on_subnet( subrec, global_myworkgroup )) == NULL) + if((work = find_workgroup_on_subnet( subrec, lp_workgroup() )) == NULL) continue; - if((servrec = find_server_in_workgroup( work, my_netbios_names[i])) == NULL) + if((servrec = find_server_in_workgroup( work, my_netbios_names(i))) == NULL) continue; stype |= servrec->serv.type; } /* Output server details, plus what workgroup they're in. */ - write_browse_list_entry(fp, my_netbios_names[i], stype, - string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH), global_myworkgroup); + write_browse_list_entry(fp, my_netbios_names(i), stype, + string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH), lp_workgroup()); } for (subrec = FIRST_SUBNET; subrec ; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec)) diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c index e68fc1589ca..3ca33c4e538 100644 --- a/source3/nmbd/nmbd_subnetdb.c +++ b/source3/nmbd/nmbd_subnetdb.c @@ -30,9 +30,6 @@ extern int ClientNMB; extern int ClientDGRAM; extern int global_nmb_port; -extern fstring myworkgroup; -extern char **my_netbios_names; - /* This is the broadcast subnets database. */ struct subnet_record *subnetlist = NULL; diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c index 24adf4e69f2..30c7d579f18 100644 --- a/source3/nmbd/nmbd_synclists.c +++ b/source3/nmbd/nmbd_synclists.c @@ -247,7 +247,7 @@ static void complete_sync(struct sync_record *s) unsigned type; pstring comment; pstring line; - char *ptr; + const char *ptr; int count=0; f = x_fopen(s->fname,O_RDONLY, 0); diff --git a/source3/nmbd/nmbd_workgroupdb.c b/source3/nmbd/nmbd_workgroupdb.c index d1cfc24a317..f2dc80dfe5c 100644 --- a/source3/nmbd/nmbd_workgroupdb.c +++ b/source3/nmbd/nmbd_workgroupdb.c @@ -26,9 +26,6 @@ extern int ClientNMB; -extern pstring global_myname; -extern fstring global_myworkgroup; -extern char **my_netbios_names; extern uint16 samba_nb_type; int workgroup_count = 0; /* unique index key: one for each workgroup */ @@ -226,7 +223,7 @@ void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_reco { int i; - if(!strequal(global_myworkgroup, work->work_group)) + if(!strequal(lp_workgroup(), work->work_group)) return; /* If this is a broadcast subnet then start elections on it @@ -244,21 +241,21 @@ workgroup %s on subnet %s\n", work->work_group, subrec->subnet_name)); /* Register the WORKGROUP<0> and WORKGROUP<1e> names on the network. */ - register_name(subrec,global_myworkgroup,0x0,samba_nb_type|NB_GROUP, + register_name(subrec,lp_workgroup(),0x0,samba_nb_type|NB_GROUP, NULL, fail_register,NULL); - register_name(subrec,global_myworkgroup,0x1e,samba_nb_type|NB_GROUP, + register_name(subrec,lp_workgroup(),0x1e,samba_nb_type|NB_GROUP, NULL, fail_register,NULL); - for( i = 0; my_netbios_names[i]; i++) + for( i = 0; my_netbios_names(i); i++) { - char *name = my_netbios_names[i]; + const char *name = my_netbios_names(i); int stype = lp_default_server_announce() | (lp_local_master() ? SV_TYPE_POTENTIAL_BROWSER : 0 ); - if(!strequal(global_myname, name)) + if(!strequal(global_myname(), name)) stype &= ~(SV_TYPE_MASTER_BROWSER|SV_TYPE_POTENTIAL_BROWSER| SV_TYPE_DOMAIN_MASTER|SV_TYPE_DOMAIN_MEMBER); diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c index ed51d852cd7..f03b0493def 100644 --- a/source3/nsswitch/wbinfo.c +++ b/source3/nsswitch/wbinfo.c @@ -62,7 +62,7 @@ static char winbind_separator(void) return sep; } -static char *get_winbind_domain(void) +static const char *get_winbind_domain(void) { struct winbindd_response response; static fstring winbind_domain; @@ -206,7 +206,7 @@ static BOOL wbinfo_list_domains(void) /* Display response */ if (response.extra_data) { - char *extra_data = (char *)response.extra_data; + const char *extra_data = (char *)response.extra_data; while(next_token(&extra_data, name, ",", sizeof(fstring))) d_printf("%s\n", name); @@ -514,7 +514,7 @@ static BOOL wbinfo_auth_crap(char *username) static BOOL print_domain_users(void) { struct winbindd_response response; - char *extra_data; + const char *extra_data; fstring name; /* Send request to winbind daemon */ @@ -530,7 +530,7 @@ static BOOL print_domain_users(void) if (!response.extra_data) return False; - extra_data = (char *)response.extra_data; + extra_data = (const char *)response.extra_data; while(next_token(&extra_data, name, ",", sizeof(fstring))) d_printf("%s\n", name); @@ -545,7 +545,7 @@ static BOOL print_domain_users(void) static BOOL print_domain_groups(void) { struct winbindd_response response; - char *extra_data; + const char *extra_data; fstring name; ZERO_STRUCT(response); @@ -559,7 +559,7 @@ static BOOL print_domain_groups(void) if (!response.extra_data) return False; - extra_data = (char *)response.extra_data; + extra_data = (const char *)response.extra_data; while(next_token(&extra_data, name, ",", sizeof(fstring))) d_printf("%s\n", name); @@ -679,7 +679,6 @@ enum { int main(int argc, char **argv) { - extern pstring global_myname; int opt; poptContext pc; @@ -717,21 +716,15 @@ int main(int argc, char **argv) /* Samba client initialisation */ - if (!*global_myname) { - char *p; - - fstrcpy(global_myname, myhostname()); - p = strchr(global_myname, '.'); - if (p) - *p = 0; - } - if (!lp_load(dyn_CONFIGFILE, True, False, False)) { d_fprintf(stderr, "wbinfo: error opening config file %s. Error was %s\n", dyn_CONFIGFILE, strerror(errno)); exit(1); } + if (!init_names()) + return 1; + load_interfaces(); /* Parse options */ diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 2bd6d7967c2..8ec8bdced6f 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -744,8 +744,6 @@ static void usage(void) int main(int argc, char **argv) { extern BOOL AllowDebugChange; - extern pstring global_myname; - extern fstring global_myworkgroup; pstring logfile; BOOL interactive = False; int opt; @@ -826,16 +824,8 @@ static void usage(void) /* Setup names. */ - if (!*global_myname) { - char *p; - - fstrcpy(global_myname, myhostname()); - p = strchr(global_myname, '.'); - if (p) - *p = 0; - } - - fstrcpy(global_myworkgroup, lp_workgroup()); + if (!init_names()) + exit(1); if (!interactive) { become_daemon(); diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c index b4d5a664b2d..d44219d1725 100644 --- a/source3/nsswitch/winbindd_cm.c +++ b/source3/nsswitch/winbindd_cm.c @@ -356,7 +356,6 @@ static NTSTATUS cm_open_connection(const char *domain, const int pipe_index, struct winbindd_cm_conn *new_conn) { struct failed_connection_cache *fcc; - extern pstring global_myname; NTSTATUS result; char *ipc_username, *ipc_domain, *ipc_password; struct in_addr dc_ip; @@ -414,7 +413,7 @@ static NTSTATUS cm_open_connection(const char *domain, const int pipe_index, cm_get_ipc_userpass(&ipc_username, &ipc_domain, &ipc_password); DEBUG(5, ("connecting to %s from %s with username [%s]\\[%s]\n", - new_conn->controller, global_myname, ipc_domain, ipc_username)); + new_conn->controller, global_myname(), ipc_domain, ipc_username)); for (i = 0; retry && (i < 3); i++) { @@ -423,7 +422,7 @@ static NTSTATUS cm_open_connection(const char *domain, const int pipe_index, continue; } - result = cli_full_connection(&(new_conn->cli), global_myname, new_conn->controller, + result = cli_full_connection(&new_conn->cli, global_myname(), new_conn->controller, &dc_ip, 0, "IPC$", "IPC", ipc_username, ipc_domain, ipc_password, 0, &retry); @@ -585,7 +584,7 @@ done: /* Return a LSA policy handle on a domain */ -CLI_POLICY_HND *cm_get_lsa_handle(char *domain) +CLI_POLICY_HND *cm_get_lsa_handle(const char *domain) { struct winbindd_cm_conn *conn; uint32 des_access = SEC_RIGHTS_MAXIMUM_ALLOWED; @@ -912,7 +911,7 @@ CLI_POLICY_HND *cm_get_sam_group_handle(char *domain, DOM_SID *domain_sid, /* Get a handle on a netlogon pipe. This is a bit of a hack to re-use the netlogon pipe as no handle is returned. */ -NTSTATUS cm_get_netlogon_cli(char *domain, unsigned char *trust_passwd, +NTSTATUS cm_get_netlogon_cli(const char *domain, const unsigned char *trust_passwd, struct cli_state **cli) { NTSTATUS result = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; diff --git a/source3/nsswitch/winbindd_misc.c b/source3/nsswitch/winbindd_misc.c index c2e744c0a7e..d656c3ca4d7 100644 --- a/source3/nsswitch/winbindd_misc.c +++ b/source3/nsswitch/winbindd_misc.c @@ -26,12 +26,10 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND -extern pstring global_myname; - /************************************************************************ Routine to get the trust account password for a domain ************************************************************************/ -static BOOL _get_trust_account_password(char *domain, unsigned char *ret_pwd, +static BOOL _get_trust_account_password(const char *domain, unsigned char *ret_pwd, time_t *pass_last_set_time) { if (!secrets_fetch_trust_account_password(domain, ret_pwd, pass_last_set_time)) { diff --git a/source3/nsswitch/winbindd_pam.c b/source3/nsswitch/winbindd_pam.c index 969cf272a37..733ccb4cd65 100644 --- a/source3/nsswitch/winbindd_pam.c +++ b/source3/nsswitch/winbindd_pam.c @@ -68,8 +68,6 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state) DATA_BLOB lm_resp; DATA_BLOB nt_resp; - extern pstring global_myname; - /* Ensure null termination */ state->request.data.auth.user[sizeof(state->request.data.auth.user)-1]='\0'; @@ -135,7 +133,7 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state) result = cli_netlogon_sam_network_logon(cli, mem_ctx, name_user, name_domain, - global_myname, chal, + global_myname(), chal, lm_resp, nt_resp, &info3); @@ -169,14 +167,12 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) struct cli_state *cli = NULL; TALLOC_CTX *mem_ctx = NULL; char *user = NULL; - char *domain = NULL; - char *contact_domain; - char *workstation; + const char *domain = NULL; + const char *contact_domain; + const char *workstation; DATA_BLOB lm_resp, nt_resp; - extern pstring global_myname; - /* Ensure null termination */ state->request.data.auth_crap.user[sizeof(state->request.data.auth_crap.user)-1]='\0'; @@ -194,9 +190,11 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) } if (*state->request.data.auth_crap.domain) { - if (pull_utf8_talloc(mem_ctx, &domain, state->request.data.auth_crap.domain) < 0) { + char *dom = NULL; + if (pull_utf8_talloc(mem_ctx, &dom, state->request.data.auth_crap.domain) < 0) { DEBUG(0, ("winbindd_pam_auth_crap: pull_utf8_talloc failed!\n")); } + domain = dom; } else if (lp_winbind_use_default_domain()) { domain = lp_workgroup(); } else { @@ -216,11 +214,13 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) } if (*state->request.data.auth_crap.workstation) { - if (pull_utf8_talloc(mem_ctx, &workstation, state->request.data.auth_crap.workstation) < 0) { + char *wrk = NULL; + if (pull_utf8_talloc(mem_ctx, &wrk, state->request.data.auth_crap.workstation) < 0) { DEBUG(0, ("winbindd_pam_auth_crap: pull_utf8_talloc failed!\n")); } + workstation = wrk; } else { - workstation = global_myname; + workstation = global_myname(); } if (state->request.data.auth_crap.lm_resp_len > sizeof(state->request.data.auth_crap.lm_resp) diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c index 1d18e8fda79..5ad4bada375 100644 --- a/source3/nsswitch/winbindd_util.c +++ b/source3/nsswitch/winbindd_util.c @@ -402,7 +402,7 @@ BOOL winbindd_param_init(void) BOOL check_domain_env(char *domain_env, char *domain) { fstring name; - char *tmp = domain_env; + const char *tmp = domain_env; while(next_token(&tmp, name, ",", sizeof(fstring))) { if (strequal(name, domain)) @@ -413,7 +413,6 @@ BOOL check_domain_env(char *domain_env, char *domain) } /* Parse a string of the form DOMAIN/user into a domain and a user */ -extern fstring global_myworkgroup; BOOL parse_domain_user(const char *domuser, fstring domain, fstring user) { @@ -424,7 +423,7 @@ BOOL parse_domain_user(const char *domuser, fstring domain, fstring user) if(!p && lp_winbind_use_default_domain()) { fstrcpy(user, domuser); - fstrcpy(domain, global_myworkgroup); + fstrcpy(domain, lp_workgroup()); } else { fstrcpy(user, p+1); fstrcpy(domain, domuser); @@ -439,13 +438,13 @@ BOOL parse_domain_user(const char *domuser, fstring domain, fstring user) 'winbind separator' options. This means: - omit DOMAIN when 'winbind use default domain = true' and DOMAIN is - global_myworkgroup + lp_workgroup */ void fill_domain_username(fstring name, const char *domain, const char *user) { if(lp_winbind_use_default_domain() && - !strcmp(global_myworkgroup, domain)) { + !strcmp(lp_workgroup(), domain)) { strlcpy(name, user, sizeof(fstring)); } else { slprintf(name, sizeof(fstring) - 1, "%s%s%s", diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 883d2719806..72831df070c 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -56,8 +56,6 @@ BOOL bLoaded = False; extern userdom_struct current_user_info; extern pstring user_socket_options; -extern pstring global_myname; -pstring global_scope = ""; #ifndef GLOBAL_NAME #define GLOBAL_NAME "global" @@ -115,7 +113,6 @@ typedef struct char **szSamBackend; char *szPasswordServer; char *szSocketOptions; - char *szWorkGroup; char *szRealm; char *szADSserver; char *szUsernameMap; @@ -273,8 +270,6 @@ global; static global Globals; - - /* * This structure describes a single service. */ @@ -533,6 +528,9 @@ static BOOL handle_winbind_uid(char *pszParmValue, char **ptr); static BOOL handle_winbind_gid(char *pszParmValue, char **ptr); static BOOL handle_non_unix_account_range(char *pszParmValue, char **ptr); static BOOL handle_debug_list( char *pszParmValue, char **ptr ); +static BOOL handle_workgroup( char *pszParmValue, char **ptr ); +static BOOL handle_netbios_aliases( char *pszParmValue, char **ptr ); +static BOOL handle_netbios_scope( char *pszParmValue, char **ptr ); static BOOL handle_ldap_machine_suffix ( char *pszParmValue, char **ptr ); static BOOL handle_ldap_user_suffix ( char *pszParmValue, char **ptr ); @@ -708,12 +706,12 @@ static struct parm_struct parm_table[] = { {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER}, {"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER}, {"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_HIDE}, - {"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkGroup, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, + {"workgroup", P_USTRING, P_GLOBAL, NULL, handle_workgroup, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, {"realm", P_USTRING, P_GLOBAL, &Globals.szRealm, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, {"ADS server", P_STRING, P_GLOBAL, &Globals.szADSserver, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, - {"netbios name", P_UGSTRING, P_GLOBAL, global_myname, handle_netbios_name, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, - {"netbios aliases", P_LIST, P_GLOBAL, &Globals.szNetbiosAliases, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, - {"netbios scope", P_UGSTRING, P_GLOBAL, global_scope, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER}, + {"netbios name", P_UGSTRING, P_GLOBAL, NULL, handle_netbios_name, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, + {"netbios aliases", P_LIST, P_GLOBAL, &Globals.szNetbiosAliases, handle_netbios_aliases, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, + {"netbios scope", P_UGSTRING, P_GLOBAL, NULL, handle_netbios_scope, NULL, FLAG_ADVANCED | FLAG_DEVELOPER}, {"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_DEVELOPER}, {"interfaces", P_LIST, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, {"bind interfaces only", P_BOOL, P_GLOBAL, &Globals.bBindInterfacesOnly, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, @@ -1094,15 +1092,14 @@ static struct parm_struct parm_table[] = { {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0} }; - /*************************************************************************** -Initialise the sDefault parameter structure for the printer values. + Initialise the sDefault parameter structure for the printer values. ***************************************************************************/ + static void init_printer_values(void) { /* choose defaults depending on the type of printing */ - switch (sDefault.iPrinting) - { + switch (sDefault.iPrinting) { case PRINT_BSD: case PRINT_AIX: case PRINT_LPRNT: @@ -1211,15 +1208,15 @@ static void init_printer_values(void) } /*************************************************************************** -Initialise the global parameter structure. + Initialise the global parameter structure. ***************************************************************************/ + static void init_globals(void) { static BOOL done_init = False; pstring s; - if (!done_init) - { + if (!done_init) { int i; memset((void *)&Globals, '\0', sizeof(Globals)); @@ -1258,7 +1255,7 @@ static void init_globals(void) * Allow the default PASSWD_CHAT to be overridden in local.h. */ string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT); - string_set(&Globals.szWorkGroup, WORKGROUP); + set_global_myworkgroup(WORKGROUP); string_set(&Globals.szPasswdProgram, ""); string_set(&Globals.szPrintcapname, PRINTCAP_NAME); string_set(&Globals.szPidDir, dyn_PIDDIR); @@ -1432,8 +1429,9 @@ static void init_globals(void) static TALLOC_CTX *lp_talloc; /******************************************************************* a -free up temporary memory - called from the main loop + Free up temporary memory - called from the main loop. ********************************************************************/ + void lp_talloc_free(void) { if (!lp_talloc) @@ -1443,10 +1441,11 @@ void lp_talloc_free(void) } /******************************************************************* -convenience routine to grab string parameters into temporary memory -and run standard_sub_basic on them. The buffers can be written to by -callers without affecting the source string. + Convenience routine to grab string parameters into temporary memory + and run standard_sub_basic on them. The buffers can be written to by + callers without affecting the source string. ********************************************************************/ + static char *lp_string(const char *s) { size_t len = s ? strlen(s) : 0; @@ -1483,7 +1482,6 @@ static char *lp_string(const char *s) return (ret); } - /* In this section all the functions that are used to access the parameters from the rest of the program are defined @@ -1494,7 +1492,7 @@ static char *lp_string(const char *s) #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \ const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");} #define FN_GLOBAL_LIST(fn_name,ptr) \ - char **fn_name(void) {return(*(char ***)(ptr));} + const char **fn_name(void) {return(*(const char ***)(ptr));} #define FN_GLOBAL_BOOL(fn_name,ptr) \ BOOL fn_name(void) {return(*(BOOL *)(ptr));} #define FN_GLOBAL_CHAR(fn_name,ptr) \ @@ -1507,7 +1505,7 @@ static char *lp_string(const char *s) #define FN_LOCAL_CONST_STRING(fn_name,val) \ const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);} #define FN_LOCAL_LIST(fn_name,val) \ - char **fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} + const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} #define FN_LOCAL_BOOL(fn_name,val) \ BOOL fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} #define FN_LOCAL_CHAR(fn_name,val) \ @@ -1549,7 +1547,6 @@ FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram) FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat) FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer) FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder) -FN_GLOBAL_STRING(lp_workgroup, &Globals.szWorkGroup) FN_GLOBAL_STRING(lp_realm, &Globals.szRealm) FN_GLOBAL_STRING(lp_ads_server, &Globals.szADSserver) FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap) @@ -1811,6 +1808,7 @@ static param_opt_struct *param_opt = NULL; /* Return parametric option from given service. Type is a part of option before ':' */ /* Parametric option has following syntax: 'Type: option = value' */ /* Returned value is allocated in 'lp_talloc' context */ + char *lp_parm_string(const char *servicename, const char *type, const char *option) { param_opt_struct *data; @@ -1856,34 +1854,33 @@ static void init_copymap(service * pservice); /*************************************************************************** -initialise a service to the defaults + Initialise a service to the defaults. ***************************************************************************/ + static void init_service(service * pservice) { memset((char *)pservice, '\0', sizeof(service)); copy_service(pservice, &sDefault, NULL); } - /*************************************************************************** -free the dynamically allocated parts of a service struct + Free the dynamically allocated parts of a service struct. ***************************************************************************/ -static void free_service(service * pservice) + +static void free_service(service *pservice) { int i; if (!pservice) return; if (pservice->szService) - DEBUG(5, - ("free_service: Freeing service %s\n", + DEBUG(5, ("free_service: Freeing service %s\n", pservice->szService)); string_free(&pservice->szService); SAFE_FREE(pservice->copymap); - for (i = 0; parm_table[i].label; i++) - { + for (i = 0; parm_table[i].label; i++) { if ((parm_table[i].type == P_STRING || parm_table[i].type == P_USTRING) && parm_table[i].class == P_LOCAL) @@ -1902,10 +1899,11 @@ static void free_service(service * pservice) } /*************************************************************************** -add a new service to the services array initialising it with the given -service. + Add a new service to the services array initialising it with the given + service. ***************************************************************************/ -static int add_a_service(const service * pservice, const char *name) + +static int add_a_service(const service *pservice, const char *name) { int i; service tservice; @@ -1914,8 +1912,7 @@ static int add_a_service(const service * pservice, const char *name) tservice = *pservice; /* it might already exist */ - if (name) - { + if (name) { i = getservicebyname(name, NULL); if (i >= 0) return (i); @@ -1927,8 +1924,7 @@ static int add_a_service(const service * pservice, const char *name) break; /* if not, then create one */ - if (i == iNumServices) - { + if (i == iNumServices) { service **tsp; tsp = (service **) Realloc(ServicePtrs, @@ -1950,8 +1946,7 @@ static int add_a_service(const service * pservice, const char *name) } iNumServices++; - } - else + } else free_service(ServicePtrs[i]); ServicePtrs[i]->valid = True; @@ -1959,16 +1954,15 @@ static int add_a_service(const service * pservice, const char *name) init_service(ServicePtrs[i]); copy_service(ServicePtrs[i], &tservice, NULL); if (name) - { string_set(&ServicePtrs[i]->szService, name); - } return (i); } /*************************************************************************** -add a new home service, with the specified home directory, defaults coming -from service ifrom. + Add a new home service, with the specified home directory, defaults coming + from service ifrom. ***************************************************************************/ + BOOL lp_add_home(const char *pszHomename, int iDefaultService, const char *user, const char *pszHomedir) { @@ -1990,8 +1984,7 @@ BOOL lp_add_home(const char *pszHomename, int iDefaultService, string_set(&ServicePtrs[i]->szPath, newHomedir); - if (!(*(ServicePtrs[i]->comment))) - { + if (!(*(ServicePtrs[i]->comment))) { pstring comment; slprintf(comment, sizeof(comment) - 1, "Home directory of %s", user); @@ -2000,25 +1993,25 @@ BOOL lp_add_home(const char *pszHomename, int iDefaultService, ServicePtrs[i]->bAvailable = sDefault.bAvailable; ServicePtrs[i]->bBrowseable = sDefault.bBrowseable; - DEBUG(3, - ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename, + DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename, user, newHomedir)); return (True); } /*************************************************************************** -add a new service, based on an old one. + Add a new service, based on an old one. ***************************************************************************/ + int lp_add_service(const char *pszService, int iDefaultService) { return (add_a_service(ServicePtrs[iDefaultService], pszService)); } - /*************************************************************************** -add the IPC service + Add the IPC service. ***************************************************************************/ + static BOOL lp_add_ipc(char *ipc_name, BOOL guest_ok) { pstring comment; @@ -2048,8 +2041,9 @@ static BOOL lp_add_ipc(char *ipc_name, BOOL guest_ok) } /*************************************************************************** -add a new printer service, with defaults coming from service iFrom. + Add a new printer service, with defaults coming from service iFrom. ***************************************************************************/ + BOOL lp_add_printer(const char *pszPrintername, int iDefaultService) { const char *comment = "From Printcap"; @@ -2084,9 +2078,10 @@ BOOL lp_add_printer(const char *pszPrintername, int iDefaultService) } /*************************************************************************** -Map a parameter's string representation to something we can use. -Returns False if the parameter string is not recognised, else TRUE. + Map a parameter's string representation to something we can use. + Returns False if the parameter string is not recognised, else TRUE. ***************************************************************************/ + static int map_parameter(char *pszParmName) { int iIndex; @@ -2107,12 +2102,12 @@ static int map_parameter(char *pszParmName) return (-1); } - /*************************************************************************** -Set a boolean variable from the text value stored in the passed string. -Returns True in success, False if the passed string does not correctly -represent a boolean. + Set a boolean variable from the text value stored in the passed string. + Returns True in success, False if the passed string does not correctly + represent a boolean. ***************************************************************************/ + static BOOL set_boolean(BOOL *pb, char *pszParmValue) { BOOL bRetval; @@ -2122,13 +2117,11 @@ static BOOL set_boolean(BOOL *pb, char *pszParmValue) strwicmp(pszParmValue, "true") == 0 || strwicmp(pszParmValue, "1") == 0) *pb = True; - else - if (strwicmp(pszParmValue, "no") == 0 || + else if (strwicmp(pszParmValue, "no") == 0 || strwicmp(pszParmValue, "False") == 0 || strwicmp(pszParmValue, "0") == 0) *pb = False; - else - { + else { DEBUG(0, ("ERROR: Badly formed boolean in configuration file: \"%s\".\n", pszParmValue)); @@ -2140,14 +2133,14 @@ static BOOL set_boolean(BOOL *pb, char *pszParmValue) /*************************************************************************** Find a service by name. Otherwise works like get_service. ***************************************************************************/ + static int getservicebyname(const char *pszServiceName, service * pserviceDest) { int iService; for (iService = iNumServices - 1; iService >= 0; iService--) if (VALID(iService) && - strwicmp(ServicePtrs[iService]->szService, pszServiceName) == 0) - { + strwicmp(ServicePtrs[iService]->szService, pszServiceName) == 0) { if (pserviceDest != NULL) copy_service(pserviceDest, ServicePtrs[iService], NULL); break; @@ -2156,23 +2149,19 @@ static int getservicebyname(const char *pszServiceName, service * pserviceDest) return (iService); } - - /*************************************************************************** -Copy a service structure to another - -If pcopymapDest is NULL then copy all fields + Copy a service structure to another. + If pcopymapDest is NULL then copy all fields ***************************************************************************/ -static void copy_service(service * pserviceDest, - service * pserviceSource, BOOL *pcopymapDest) + +static void copy_service(service * pserviceDest, service * pserviceSource, BOOL *pcopymapDest) { int i; BOOL bcopyall = (pcopymapDest == NULL); for (i = 0; parm_table[i].label; i++) if (parm_table[i].ptr && parm_table[i].class == P_LOCAL && - (bcopyall || pcopymapDest[i])) - { + (bcopyall || pcopymapDest[i])) { void *def_ptr = parm_table[i].ptr; void *src_ptr = ((char *)pserviceSource) + PTR_DIFF(def_ptr, @@ -2181,8 +2170,7 @@ static void copy_service(service * pserviceDest, ((char *)pserviceDest) + PTR_DIFF(def_ptr, &sDefault); - switch (parm_table[i].type) - { + switch (parm_table[i].type) { case P_BOOL: case P_BOOLREV: *(BOOL *)dest_ptr = *(BOOL *)src_ptr; @@ -2209,15 +2197,14 @@ static void copy_service(service * pserviceDest, strupper(*(char **)dest_ptr); break; case P_LIST: - str_list_copy((char ***)dest_ptr, *(char ***)src_ptr); + str_list_copy((char ***)dest_ptr, *(const char ***)src_ptr); break; default: break; } } - if (bcopyall) - { + if (bcopyall) { init_copymap(pserviceDest); if (pserviceSource->copymap) memcpy((void *)pserviceDest->copymap, @@ -2230,15 +2217,14 @@ static void copy_service(service * pserviceDest, Check a service for consistency. Return False if the service is in any way incomplete or faulty, else True. ***************************************************************************/ + static BOOL service_ok(int iService) { BOOL bRetval; bRetval = True; - if (ServicePtrs[iService]->szService[0] == '\0') - { - DEBUG(0, - ("The following message indicates an internal error:\n")); + if (ServicePtrs[iService]->szService[0] == '\0') { + DEBUG(0, ("The following message indicates an internal error:\n")); DEBUG(0, ("No service name in service entry.\n")); bRetval = False; } @@ -2247,8 +2233,7 @@ static BOOL service_ok(int iService) /* I can't see why you'd want a non-printable printer service... */ if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) { if (!ServicePtrs[iService]->bPrint_ok) { - DEBUG(0, - ("WARNING: [%s] service MUST be printable!\n", + DEBUG(0, ("WARNING: [%s] service MUST be printable!\n", ServicePtrs[iService]->szService)); ServicePtrs[iService]->bPrint_ok = True; } @@ -2258,10 +2243,8 @@ static BOOL service_ok(int iService) } if (ServicePtrs[iService]->szPath[0] == '\0' && - strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0) - { - DEBUG(0, - ("No path in service %s - using %s\n", + strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0) { + DEBUG(0, ("No path in service %s - using %s\n", ServicePtrs[iService]->szService, tmpdir())); string_set(&ServicePtrs[iService]->szPath, tmpdir()); } @@ -2274,45 +2257,40 @@ static BOOL service_ok(int iService) return (bRetval); } -static struct file_lists -{ +static struct file_lists { struct file_lists *next; char *name; char *subfname; time_t modtime; -} - *file_lists = NULL; +} *file_lists = NULL; /******************************************************************* -keep a linked list of all config files so we know when one has changed -it's date and needs to be reloaded + Keep a linked list of all config files so we know when one has changed + it's date and needs to be reloaded. ********************************************************************/ + static void add_to_file_list(const char *fname, const char *subfname) { struct file_lists *f = file_lists; - while (f) - { + while (f) { if (f->name && !strcmp(f->name, fname)) break; f = f->next; } - if (!f) - { + if (!f) { f = (struct file_lists *)malloc(sizeof(file_lists[0])); if (!f) return; f->next = file_lists; f->name = strdup(fname); - if (!f->name) - { + if (!f->name) { SAFE_FREE(f); return; } f->subfname = strdup(subfname); - if (!f->subfname) - { + if (!f->subfname) { SAFE_FREE(f); return; } @@ -2326,8 +2304,9 @@ static void add_to_file_list(const char *fname, const char *subfname) } /******************************************************************* -check if a config file has changed date + Check if a config file has changed date. ********************************************************************/ + BOOL lp_file_list_changed(void) { struct file_lists *f = file_lists; @@ -2372,17 +2351,31 @@ static BOOL handle_netbios_name(char *pszParmValue, char **ptr) pstrcpy(netbios_name, pszParmValue); standard_sub_basic(current_user_info.smb_name, netbios_name,sizeof(netbios_name)); - strupper(netbios_name); - pstrcpy(global_myname, netbios_name); + set_global_myname(netbios_name); - DEBUG(4, - ("handle_netbios_name: set global_myname to: %s\n", - global_myname)); + DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n", + global_myname())); return (True); } +static BOOL handle_workgroup(char *pszParmValue, char **ptr) +{ + return set_global_myworkgroup(pszParmValue); +} + +static BOOL handle_netbios_scope(char *pszParmValue, char **ptr) +{ + return set_global_scope(pszParmValue); +} + +static BOOL handle_netbios_aliases(char *pszParmValue, char **ptr) +{ + Globals.szNetbiosAliases = str_list_make(pszParmValue, NULL); + return set_netbios_aliases((const char **)Globals.szNetbiosAliases); +} + /*************************************************************************** Do the work of sourcing in environment variable/value pairs. ***************************************************************************/ @@ -2394,8 +2387,7 @@ static BOOL source_env(char **lines) int i; char *p; - for (i = 0; lines[i]; i++) - { + for (i = 0; lines[i]; i++) { char *line = lines[i]; if ((len = strlen(line)) == 0) @@ -2404,8 +2396,7 @@ static BOOL source_env(char **lines) if (line[len - 1] == '\n') line[--len] = '\0'; - if ((varval = malloc(len + 1)) == NULL) - { + if ((varval = malloc(len + 1)) == NULL) { DEBUG(0, ("source_env: Not enough memory!\n")); return (False); } @@ -2415,25 +2406,20 @@ static BOOL source_env(char **lines) varval[len] = '\0'; p = strchr_m(line, (int)'='); - if (p == NULL) - { + if (p == NULL) { DEBUG(4, ("source_env: missing '=': %s\n", line)); continue; } - if (putenv(varval)) - { - DEBUG(0, - ("source_env: Failed to put environment variable %s\n", + if (putenv(varval)) { + DEBUG(0, ("source_env: Failed to put environment variable %s\n", varval)); continue; } *p = '\0'; p++; - DEBUG(4, - ("source_env: getting var %s = %s\n", line, - getenv(line))); + DEBUG(4, ("source_env: getting var %s = %s\n", line, getenv(line))); } DEBUG(4, ("source_env: returning successfully\n")); @@ -2441,7 +2427,7 @@ static BOOL source_env(char **lines) } /*************************************************************************** - Handle the source environment operation + Handle the source environment operation. ***************************************************************************/ static BOOL handle_source_env(char *pszParmValue, char **ptr) @@ -2464,18 +2450,12 @@ static BOOL handle_source_env(char *pszParmValue, char **ptr) */ if (*p == '|') - { lines = file_lines_pload(p + 1, NULL); - } else - { lines = file_lines_load(fname, NULL); - } - if (!lines) - { - DEBUG(0, - ("handle_source_env: Failed to open file %s, Error was %s\n", + if (!lines) { + DEBUG(0, ("handle_source_env: Failed to open file %s, Error was %s\n", fname, strerror(errno))); return (False); } @@ -2487,8 +2467,9 @@ static BOOL handle_source_env(char *pszParmValue, char **ptr) } /*************************************************************************** - handle the interpretation of the vfs object parameter - *************************************************************************/ + Handle the interpretation of the vfs object parameter. +*************************************************************************/ + static BOOL handle_vfs_object(char *pszParmValue, char **ptr) { /* Set string value */ @@ -2501,9 +2482,8 @@ static BOOL handle_vfs_object(char *pszParmValue, char **ptr) return True; } - /*************************************************************************** -handle the include operation + Handle the include operation. ***************************************************************************/ static BOOL handle_include(char *pszParmValue, char **ptr) @@ -2525,10 +2505,10 @@ static BOOL handle_include(char *pszParmValue, char **ptr) return (False); } - /*************************************************************************** -handle the interpretation of the copy parameter + Handle the interpretation of the copy parameter. ***************************************************************************/ + static BOOL handle_copy(char *pszParmValue, char **ptr) { BOOL bRetval; @@ -2543,26 +2523,17 @@ static BOOL handle_copy(char *pszParmValue, char **ptr) DEBUG(3, ("Copying service from service %s\n", pszParmValue)); - if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) - { - if (iTemp == iServiceIndex) - { - DEBUG(0, - ("Can't copy service %s - unable to copy self!\n", - pszParmValue)); - } - else - { + if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) { + if (iTemp == iServiceIndex) { + DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue)); + } else { copy_service(ServicePtrs[iServiceIndex], &serviceTemp, ServicePtrs[iServiceIndex]->copymap); bRetval = True; } - } - else - { - DEBUG(0, ("Unable to copy service - source not found: %s\n", - pszParmValue)); + } else { + DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue)); bRetval = False; } @@ -2668,7 +2639,9 @@ static BOOL handle_winbind_gid(char *pszParmValue, char **ptr) return True; } -/* Do some simple checks on "non unix account range" parameter values */ +/*************************************************************************** + Do some simple checks on "non unix account range" parameter values. +***************************************************************************/ static BOOL handle_non_unix_account_range(char *pszParmValue, char **ptr) { @@ -2688,8 +2661,9 @@ static BOOL handle_non_unix_account_range(char *pszParmValue, char **ptr) } /*************************************************************************** - Handle the DEBUG level list + Handle the DEBUG level list. ***************************************************************************/ + static BOOL handle_debug_list( char *pszParmValueIn, char **ptr ) { pstring pszParmValue; @@ -2700,8 +2674,9 @@ static BOOL handle_debug_list( char *pszParmValueIn, char **ptr ) } /*************************************************************************** - Handle the ldap machine suffix option + Handle the ldap machine suffix option. ***************************************************************************/ + static BOOL handle_ldap_machine_suffix( char *pszParmValue, char **ptr) { pstring suffix; @@ -2723,8 +2698,9 @@ static BOOL handle_ldap_machine_suffix( char *pszParmValue, char **ptr) } /*************************************************************************** - Handle the ldap user suffix option + Handle the ldap user suffix option. ***************************************************************************/ + static BOOL handle_ldap_user_suffix( char *pszParmValue, char **ptr) { pstring suffix; @@ -2747,8 +2723,9 @@ static BOOL handle_ldap_user_suffix( char *pszParmValue, char **ptr) /*************************************************************************** Handle setting ldap suffix and determines whether ldap machine suffix needs - to be set as well + to be set as well. ***************************************************************************/ + static BOOL handle_ldap_suffix( char *pszParmValue, char **ptr) { pstring suffix; @@ -2796,8 +2773,9 @@ static BOOL handle_acl_compatibility(char *pszParmValue, char **ptr) return True; } /*************************************************************************** -initialise a copymap + Initialise a copymap. ***************************************************************************/ + static void init_copymap(service * pservice) { int i; @@ -2812,20 +2790,21 @@ static void init_copymap(service * pservice) pservice->copymap[i] = True; } - /*************************************************************************** - return the local pointer to a parameter given the service number and the - pointer into the default structure + Return the local pointer to a parameter given the service number and the + pointer into the default structure. ***************************************************************************/ + void *lp_local_ptr(int snum, void *ptr) { return (void *)(((char *)ServicePtrs[snum]) + PTR_DIFF(ptr, &sDefault)); } /*************************************************************************** -Process a parameter for a particular service number. If snum < 0 -then assume we are in the globals + Process a parameter for a particular service number. If snum < 0 + then assume we are in the globals. ***************************************************************************/ + BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue) { int parmnum, i, slen; @@ -2837,8 +2816,7 @@ BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue) parmnum = map_parameter(pszParmName); - if (parmnum < 0) - { + if (parmnum < 0) { if ((sep=strchr(pszParmName, ':')) != NULL) { *sep = 0; ZERO_STRUCT(vfskey); @@ -2854,13 +2832,11 @@ BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue) *sep = ':'; return (True); } - DEBUG(0, - ("Ignoring unknown parameter \"%s\"\n", pszParmName)); + DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName)); return (True); } - if (parm_table[parmnum].flags & FLAG_DEPRECATED) - { + if (parm_table[parmnum].flags & FLAG_DEPRECATED) { DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n", pszParmName)); } @@ -2868,14 +2844,10 @@ BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue) def_ptr = parm_table[parmnum].ptr; /* we might point at a service, the default service or a global */ - if (snum < 0) - { + if (snum < 0) { parm_ptr = def_ptr; - } - else - { - if (parm_table[parmnum].class == P_GLOBAL) - { + } else { + if (parm_table[parmnum].class == P_GLOBAL) { DEBUG(0, ("Global parameter %s found in service section!\n", pszParmName)); @@ -2886,8 +2858,7 @@ BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue) &sDefault); } - if (snum >= 0) - { + if (snum >= 0) { if (!ServicePtrs[snum]->copymap) init_copymap(ServicePtrs[snum]); @@ -2899,8 +2870,7 @@ BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue) } /* if it is a special case then go ahead */ - if (parm_table[parmnum].special) - { + if (parm_table[parmnum].special) { parm_table[parmnum].special(pszParmValue, (char **)parm_ptr); return (True); } @@ -2952,13 +2922,10 @@ BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue) break; case P_ENUM: - for (i = 0; parm_table[parmnum].enum_list[i].name; - i++) - { + for (i = 0; parm_table[parmnum].enum_list[i].name; i++) { if (strequal (pszParmValue, - parm_table[parmnum].enum_list[i].name)) - { + parm_table[parmnum].enum_list[i].name)) { *(int *)parm_ptr = parm_table[parmnum]. enum_list[i].value; @@ -2974,8 +2941,9 @@ BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue) } /*************************************************************************** -Process a parameter. + Process a parameter. ***************************************************************************/ + static BOOL do_parameter(char *pszParmName, char *pszParmValue) { if (!bInGlobalSection && bGlobalOnly) @@ -2987,20 +2955,18 @@ static BOOL do_parameter(char *pszParmName, char *pszParmValue) pszParmName, pszParmValue)); } - /*************************************************************************** -print a parameter of the specified type + Print a parameter of the specified type. ***************************************************************************/ + static void print_parameter(struct parm_struct *p, void *ptr, FILE * f) { int i; switch (p->type) { case P_ENUM: - for (i = 0; p->enum_list[i].name; i++) - { - if (*(int *)ptr == p->enum_list[i].value) - { + for (i = 0; p->enum_list[i].name; i++) { + if (*(int *)ptr == p->enum_list[i].value) { fprintf(f, "%s", p->enum_list[i].name); break; @@ -3056,14 +3022,13 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f) } } - /*************************************************************************** -check if two parameters are equal + Check if two parameters are equal. ***************************************************************************/ + static BOOL equal_parameter(parm_type type, void *ptr1, void *ptr2) { - switch (type) - { + switch (type) { case P_BOOL: case P_BOOLREV: return (*((BOOL *)ptr1) == *((BOOL *)ptr2)); @@ -3115,10 +3080,11 @@ void init_locals(void) } /*************************************************************************** -Process a new section (service). At this stage all sections are services. -Later we'll have special sections that permit server parameters to be set. -Returns True on success, False on failure. + Process a new section (service). At this stage all sections are services. + Later we'll have special sections that permit server parameters to be set. + Returns True on success, False on failure. ***************************************************************************/ + static BOOL do_section(char *pszSectionName) { BOOL bRetval; @@ -3134,8 +3100,7 @@ static BOOL do_section(char *pszSectionName) bInGlobalSection = isglobal; /* check for multiple global sections */ - if (bInGlobalSection) - { + if (bInGlobalSection) { DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName)); return (True); } @@ -3150,15 +3115,13 @@ static BOOL do_section(char *pszSectionName) bRetval = service_ok(iServiceIndex); /* if all is still well, move to the next record in the services array */ - if (bRetval) - { + if (bRetval) { /* We put this here to avoid an odd message order if messages are */ /* issued by the post-processing of a previous section. */ DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName)); if ((iServiceIndex = add_a_service(&sDefault, pszSectionName)) - < 0) - { + < 0) { DEBUG(0, ("Failed to add a new service\n")); return (False); } @@ -3169,14 +3132,14 @@ static BOOL do_section(char *pszSectionName) /*************************************************************************** -determine if a partcular base parameter is currentl set to the default value. + Determine if a partcular base parameter is currentl set to the default value. ***************************************************************************/ + static BOOL is_default(int i) { if (!defaults_saved) return False; - switch (parm_table[i].type) - { + switch (parm_table[i].type) { case P_LIST: return str_list_compare (parm_table[i].def.lvalue, *(char ***)parm_table[i].ptr); @@ -3206,10 +3169,10 @@ static BOOL is_default(int i) return False; } - /*************************************************************************** Display the contents of the global structure. ***************************************************************************/ + static void dump_globals(FILE *f) { int i; @@ -3221,14 +3184,13 @@ static void dump_globals(FILE *f) for (i = 0; parm_table[i].label; i++) if (parm_table[i].class == P_GLOBAL && parm_table[i].ptr && - (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) - { + (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) { if (defaults_saved && is_default(i)) continue; fprintf(f, "\t%s = ", parm_table[i].label); print_parameter(&parm_table[i], parm_table[i].ptr, f); fprintf(f, "\n"); - } + } if (param_opt != NULL) { data = param_opt; while(data) { @@ -3243,8 +3205,9 @@ static void dump_globals(FILE *f) } /*************************************************************************** -return True if a local parameter is currently set to the global default + Return True if a local parameter is currently set to the global default. ***************************************************************************/ + BOOL lp_is_default(int snum, struct parm_struct *parm) { int pdiff = PTR_DIFF(parm->ptr, &sDefault); @@ -3255,8 +3218,9 @@ BOOL lp_is_default(int snum, struct parm_struct *parm) } /*************************************************************************** -Display the contents of a single services record. + Display the contents of a single services record. ***************************************************************************/ + static void dump_a_service(service * pService, FILE * f) { int i; @@ -3270,17 +3234,13 @@ static void dump_a_service(service * pService, FILE * f) if (parm_table[i].class == P_LOCAL && parm_table[i].ptr && (*parm_table[i].label != '-') && - (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) - { + (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) { int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault); - if (pService == &sDefault) - { + if (pService == &sDefault) { if (defaults_saved && is_default(i)) continue; - } - else - { + } else { if (equal_parameter(parm_table[i].type, ((char *)pService) + pdiff, @@ -3293,7 +3253,7 @@ static void dump_a_service(service * pService, FILE * f) print_parameter(&parm_table[i], ((char *)pService) + pdiff, f); fprintf(f, "\n"); - } + } if (param_opt != NULL) { data = param_opt; sn = (pService == &sDefault) ? "global" : pService->szService; @@ -3309,17 +3269,15 @@ static void dump_a_service(service * pService, FILE * f) /*************************************************************************** -return info about the next service in a service. snum==-1 gives the globals - -return NULL when out of parameters + Return info about the next service in a service. snum==-1 gives the globals. + Return NULL when out of parameters. ***************************************************************************/ + struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters) { - if (snum == -1) - { + if (snum == -1) { /* do the globals */ - for (; parm_table[*i].label; (*i)++) - { + for (; parm_table[*i].label; (*i)++) { if (parm_table[*i].class == P_SEPARATOR) return &parm_table[(*i)++]; @@ -3334,13 +3292,10 @@ struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters) return &parm_table[(*i)++]; } - } - else - { + } else { service *pService = ServicePtrs[snum]; - for (; parm_table[*i].label; (*i)++) - { + for (; parm_table[*i].label; (*i)++) { if (parm_table[*i].class == P_SEPARATOR) return &parm_table[(*i)++]; @@ -3374,7 +3329,7 @@ struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters) #if 0 /*************************************************************************** -Display the contents of a single copy structure. + Display the contents of a single copy structure. ***************************************************************************/ static void dump_copy_map(BOOL *pcopymap) { @@ -3395,7 +3350,7 @@ static void dump_copy_map(BOOL *pcopymap) #endif /*************************************************************************** -Return TRUE if the passed service number is within range. + Return TRUE if the passed service number is within range. ***************************************************************************/ BOOL lp_snum_ok(int iService) @@ -3452,7 +3407,9 @@ void lp_add_one_printer(char *name, char *comment) } } -/* Announce ourselves as a print server */ +/*************************************************************************** + Announce ourselves as a print server. +***************************************************************************/ void update_server_announce_as_printserver(void) { @@ -3513,7 +3470,7 @@ static void lp_save_defaults(void) switch (parm_table[i].type) { case P_LIST: str_list_copy(&(parm_table[i].def.lvalue), - *(char ***)parm_table[i].ptr); + *(const char ***)parm_table[i].ptr); break; case P_STRING: case P_USTRING: @@ -3607,12 +3564,11 @@ static void set_server_role(void) } } - - /*************************************************************************** -Load the services array from the services file. Return True on success, -False on failure. + Load the services array from the services file. Return True on success, + False on failure. ***************************************************************************/ + BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults, BOOL add_ipc) { @@ -3687,16 +3643,18 @@ BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults, } /*************************************************************************** -reset the max number of services + Reset the max number of services. ***************************************************************************/ + void lp_resetnumservices(void) { iNumServices = 0; } /*************************************************************************** -return the max number of services + Return the max number of services. ***************************************************************************/ + int lp_numservices(void) { return (iNumServices); @@ -3705,14 +3663,13 @@ int lp_numservices(void) /*************************************************************************** Display the contents of the services array in human-readable form. ***************************************************************************/ + void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint) { int iService; if (show_defaults) - { defaults_saved = False; - } dump_globals(f); @@ -3725,33 +3682,31 @@ void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint) /*************************************************************************** Display the contents of one service in human-readable form. ***************************************************************************/ + void lp_dump_one(FILE * f, BOOL show_defaults, int snum) { - if (VALID(snum)) - { + if (VALID(snum)) { if (ServicePtrs[snum]->szService[0] == '\0') return; dump_a_service(ServicePtrs[snum], f); } } - /*************************************************************************** Return the number of the service with the given name, or -1 if it doesn't exist. Note that this is a DIFFERENT ANIMAL from the internal function getservicebyname()! This works ONLY if all services have been loaded, and does not copy the found service. ***************************************************************************/ + int lp_servicenumber(const char *pszServiceName) { int iService; fstring serviceName; - for (iService = iNumServices - 1; iService >= 0; iService--) - { - if (VALID(iService) && ServicePtrs[iService]->szService) - { + for (iService = iNumServices - 1; iService >= 0; iService--) { + if (VALID(iService) && ServicePtrs[iService]->szService) { /* * The substitution here is used to support %U is * service names @@ -3785,6 +3740,7 @@ char *volume_label(int snum) /******************************************************************* Set the server type we will announce as via nmbd. ********************************************************************/ + static void set_default_server_announce_type(void) { default_server_announce = 0; @@ -3792,67 +3748,42 @@ static void set_default_server_announce_type(void) default_server_announce |= SV_TYPE_SERVER; default_server_announce |= SV_TYPE_SERVER_UNIX; - switch (lp_announce_as()) - { + switch (lp_announce_as()) { case ANNOUNCE_AS_NT_SERVER: - { default_server_announce |= SV_TYPE_SERVER_NT; /* fall through... */ - } case ANNOUNCE_AS_NT_WORKSTATION: - { default_server_announce |= SV_TYPE_NT; break; - } case ANNOUNCE_AS_WIN95: - { default_server_announce |= SV_TYPE_WIN95_PLUS; break; - } case ANNOUNCE_AS_WFW: - { default_server_announce |= SV_TYPE_WFW; break; - } default: - { break; - } } - switch (lp_server_role()) - { + switch (lp_server_role()) { case ROLE_DOMAIN_MEMBER: - { default_server_announce |= SV_TYPE_DOMAIN_MEMBER; break; - } case ROLE_DOMAIN_PDC: - { default_server_announce |= SV_TYPE_DOMAIN_CTRL; break; - } case ROLE_DOMAIN_BDC: - { default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL; break; - } case ROLE_STANDALONE: default: - { break; - } } - if (lp_time_server()) - { default_server_announce |= SV_TYPE_TIME_SOURCE; - } if (lp_host_msdfs()) - { default_server_announce |= SV_TYPE_DFS_SERVER; - } } /*********************************************************** @@ -3871,9 +3802,7 @@ int lp_server_role(void) BOOL lp_domain_master(void) { if (Globals.bDomainMaster == Auto) - { return (lp_server_role() == ROLE_DOMAIN_PDC); - } return Globals.bDomainMaster; } @@ -3885,32 +3814,29 @@ BOOL lp_domain_master(void) BOOL lp_preferred_master(void) { if (Globals.bPreferredMaster == Auto) - { return (lp_local_master() && lp_domain_master()); - } return Globals.bPreferredMaster; } - - /******************************************************************* -remove a service + Remove a service. ********************************************************************/ + void lp_remove_service(int snum) { ServicePtrs[snum]->valid = False; } /******************************************************************* -copy a service. + Copy a service. ********************************************************************/ + void lp_copy_service(int snum, char *new_name) { char *oldname = lp_servicename(snum); do_section(new_name); - if (snum >= 0) - { + if (snum >= 0) { snum = lp_servicenumber(new_name); if (snum >= 0) lp_do_parameter(snum, "copy", oldname); @@ -3921,6 +3847,7 @@ void lp_copy_service(int snum, char *new_name) /******************************************************************* Get the default server type we will announce as via nmbd. ********************************************************************/ + int lp_default_server_announce(void) { return default_server_announce; @@ -3929,6 +3856,7 @@ int lp_default_server_announce(void) /******************************************************************* Split the announce version into major and minor numbers. ********************************************************************/ + int lp_major_announce_version(void) { static BOOL got_major = False; @@ -4001,30 +3929,6 @@ void get_private_directory(pstring privdir) pstrcpy (privdir, lp_private_dir()); } - -/**************************************************************** - Is netbios alias or name -*****************************************************************/ - -BOOL is_netbios_alias_or_name(const char *name) -{ - char **netbios_aliases = lp_netbios_aliases(); - - if (StrCaseCmp(name, global_myname) == 0) { - return True; - } - - for (netbios_aliases = lp_netbios_aliases(); - netbios_aliases && *netbios_aliases; - netbios_aliases++) { - if (StrCaseCmp(name, *netbios_aliases) == 0) { - return True; - } - } - - return False; -} - /*********************************************************** Allow daemons such as winbindd to fix their logfile name. ************************************************************/ @@ -4046,7 +3950,7 @@ const char *get_called_name(void) static fstring called_name; if (! *local_machine) - return global_myname; + return global_myname(); /* * Windows NT/2k uses "*SMBSERVER" and XP uses "*SMBSERV" diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c index e1a1de83a60..071af50877e 100644 --- a/source3/passdb/machine_sid.c +++ b/source3/passdb/machine_sid.c @@ -79,7 +79,6 @@ static void generate_random_sid(DOM_SID *sid) static BOOL pdb_generate_sam_sid(void) { char *fname = NULL; - extern pstring global_myname; BOOL is_dc = False; if(global_sam_sid==NULL) @@ -98,7 +97,7 @@ static BOOL pdb_generate_sam_sid(void) break; } - if (secrets_fetch_domain_sid(global_myname, global_sam_sid)) { + if (secrets_fetch_domain_sid(global_myname(), global_sam_sid)) { DOM_SID domain_sid; /* We got our sid. If not a pdc/bdc, we're done. */ @@ -137,7 +136,7 @@ static BOOL pdb_generate_sam_sid(void) if (read_sid_from_file(fname, global_sam_sid)) { /* remember it for future reference and unlink the old MACHINE.SID */ - if (!secrets_store_domain_sid(global_myname, global_sam_sid)) { + if (!secrets_store_domain_sid(global_myname(), global_sam_sid)) { DEBUG(0,("pdb_generate_sam_sid: Failed to store SID from file.\n")); SAFE_FREE(fname); return False; @@ -162,7 +161,7 @@ static BOOL pdb_generate_sam_sid(void) generate one and save it */ generate_random_sid(global_sam_sid); - if (!secrets_store_domain_sid(global_myname, global_sam_sid)) { + if (!secrets_store_domain_sid(global_myname(), global_sam_sid)) { DEBUG(0,("pdb_generate_sam_sid: Failed to store generated machine SID.\n")); return False; } diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index de737f7df70..ef1c1180dd0 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -32,8 +32,6 @@ * responsible. */ -extern pstring global_myname; - /************************************************************ Fill the SAM_ACCOUNT with default values. ***********************************************************/ @@ -237,28 +235,28 @@ NTSTATUS pdb_fill_sam_pw(SAM_ACCOUNT *sam_account, const struct passwd *pwd) pdb_set_profile_path(sam_account, talloc_sub_specified((sam_account)->mem_ctx, lp_logon_path(), - pwd->pw_name, global_myname, + pwd->pw_name, global_myname(), pwd->pw_uid, pwd->pw_gid), PDB_DEFAULT); pdb_set_homedir(sam_account, talloc_sub_specified((sam_account)->mem_ctx, lp_logon_home(), - pwd->pw_name, global_myname, + pwd->pw_name, global_myname(), pwd->pw_uid, pwd->pw_gid), PDB_DEFAULT); pdb_set_dir_drive(sam_account, talloc_sub_specified((sam_account)->mem_ctx, lp_logon_drive(), - pwd->pw_name, global_myname, + pwd->pw_name, global_myname(), pwd->pw_uid, pwd->pw_gid), PDB_DEFAULT); pdb_set_logon_script(sam_account, talloc_sub_specified((sam_account)->mem_ctx, lp_logon_script(), - pwd->pw_name, global_myname, + pwd->pw_name, global_myname(), pwd->pw_uid, pwd->pw_gid), PDB_DEFAULT); if (!pdb_set_acct_ctrl(sam_account, ACB_NORMAL, PDB_DEFAULT)) { @@ -625,10 +623,10 @@ BOOL local_lookup_sid(DOM_SID *sid, char *name, enum SID_NAME_USE *psid_name_use DEBUG(5,("local_lookup_sid: looking up RID %u.\n", (unsigned int)rid)); if (rid == DOMAIN_USER_RID_ADMIN) { - char **admin_list = lp_admin_users(-1); + const char **admin_list = lp_admin_users(-1); *psid_name_use = SID_NAME_USER; if (admin_list) { - char *p = *admin_list; + const char *p = *admin_list; if(!next_token(&p, name, NULL, sizeof(fstring))) fstrcpy(name, "Administrator"); } else { diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index ca199f8ea6d..edc310c0c1a 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -458,7 +458,7 @@ static NTSTATUS make_pdb_context(struct pdb_context **context) Make a pdb_context, given an array of strings *******************************************************************/ -NTSTATUS make_pdb_context_list(struct pdb_context **context, char **selected) +NTSTATUS make_pdb_context_list(struct pdb_context **context, const char **selected) { int i = 0; struct pdb_methods *curmethods, *tmpmethods; @@ -492,7 +492,7 @@ NTSTATUS make_pdb_context_string(struct pdb_context **context, const char *selec { NTSTATUS ret; char **newsel = str_list_make(selected, NULL); - ret = make_pdb_context_list(context, newsel); + ret = make_pdb_context_list(context, (const char **)newsel); str_list_free(&newsel); return ret; } diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index e35775a6dad..8097d92364f 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -507,7 +507,7 @@ static int ldapsam_retry_open(struct ldapsam_privates *ldap_state, int *attempts } -static int ldapsam_search(struct ldapsam_privates *ldap_state, char *base, int scope, char *filter, char *attrs[], int attrsonly, LDAPMessage **res) +static int ldapsam_search(struct ldapsam_privates *ldap_state, const char *base, int scope, const char *filter, const char *attrs[], int attrsonly, LDAPMessage **res) { int rc = LDAP_SERVER_DOWN; int attempts = 0; @@ -636,7 +636,7 @@ static int ldapsam_search_one_user (struct ldapsam_privates *ldap_state, const c DEBUG(2, ("ldapsam_search_one_user: searching for:[%s]\n", filter)); - rc = ldapsam_search(ldap_state, lp_ldap_suffix (), scope, (char *)filter, (char **)attr, 0, result); + rc = ldapsam_search(ldap_state, lp_ldap_suffix (), scope, filter, attr, 0, result); if (rc != LDAP_SUCCESS) { DEBUG(0,("ldapsam_search_one_user: Problem during the LDAP search: %s\n", @@ -1412,7 +1412,7 @@ static uint32 search_top_nua_rid(struct ldapsam_privates *ldap_state) DEBUG(2, ("ldapsam_get_next_available_nua_rid: searching for:[%s]\n", final_filter)); rc = ldapsam_search(ldap_state, lp_ldap_suffix(), - LDAP_SCOPE_SUBTREE, final_filter, (char **)attr, 0, + LDAP_SCOPE_SUBTREE, final_filter, attr, 0, &result); if (rc != LDAP_SUCCESS) { @@ -1486,7 +1486,7 @@ static NTSTATUS ldapsam_setsampwent(struct pdb_methods *my_methods, BOOL update) all_string_sub(filter, "%u", "*", sizeof(pstring)); rc = ldapsam_search(ldap_state, lp_ldap_suffix(), - LDAP_SCOPE_SUBTREE, filter, (char **)attr, 0, + LDAP_SCOPE_SUBTREE, filter, attr, 0, &ldap_state->result); if (rc != LDAP_SUCCESS) { diff --git a/source3/passdb/util_sam_sid.c b/source3/passdb/util_sam_sid.c index 60998003f6e..0881531db81 100644 --- a/source3/passdb/util_sam_sid.c +++ b/source3/passdb/util_sam_sid.c @@ -22,9 +22,6 @@ #include "includes.h" -extern pstring global_myname; -extern fstring global_myworkgroup; - #define MAX_SID_NAMES 7 typedef struct _known_sid_users { @@ -98,16 +95,16 @@ static void init_sid_name_map (void) /* This is not lp_workgroup() for good reason: it must stay around longer than the lp_*() strings do */ - sid_name_map[i].name = global_myworkgroup; + sid_name_map[i].name = strdup(lp_workgroup()); sid_name_map[i].known_users = NULL; i++; sid_name_map[i].sid = get_global_sam_sid(); - sid_name_map[i].name = global_myname; + sid_name_map[i].name = strdup(global_myname()); sid_name_map[i].known_users = NULL; i++; } else { sid_name_map[i].sid = get_global_sam_sid(); - sid_name_map[i].name = global_myname; + sid_name_map[i].name = strdup(global_myname()); sid_name_map[i].known_users = NULL; i++; } @@ -224,7 +221,7 @@ BOOL map_domain_name_to_sid(DOM_SID *sid, char *nt_domain) } if (nt_domain[0] == 0) { - fstrcpy(nt_domain, global_myname); + fstrcpy(nt_domain, global_myname()); DEBUG(5,("map_domain_name_to_sid: overriding blank name to %s\n", nt_domain)); sid_copy(sid, get_global_sam_sid()); return True; diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c index 1307cdb3f8d..59a844689c8 100644 --- a/source3/printing/lpq_parse.c +++ b/source3/printing/lpq_parse.c @@ -232,12 +232,11 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first) #define LPRNG_MAXTOK 128 /* PFMA just to keep us from running away. */ fstring tokarr[LPRNG_MAXTOK]; - char *cptr; + const char *cptr; + char *ptr; int num_tok = 0; - pstring line2; - pstrcpy(line2,line); - cptr = line2; + cptr = line; while(next_token( &cptr, tokarr[num_tok], " \t", sizeof(fstring)) && (num_tok < LPRNG_MAXTOK)) num_tok++; @@ -273,8 +272,8 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first) * for the current user on the taskbar. Plop in a null. */ - if ((cptr = strchr_m(buf->fs_user,'@')) != NULL) { - *cptr = '\0'; + if ((ptr = strchr_m(buf->fs_user,'@')) != NULL) { + *ptr = '\0'; } StrnCpy(buf->fs_file,tokarr[LPRNG_FILETOK],sizeof(buf->fs_file)-1); @@ -314,6 +313,7 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first) { fstring tok[11]; int count=0; + const char *cline = line; /* handle the case of "(standard input)" as a filename */ string_sub(line,"standard input","STDIN",0); @@ -322,7 +322,7 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first) for (count=0; count<10 && - next_token(&line,tok[count],NULL, sizeof(tok[count])); + next_token(&cline,tok[count],NULL, sizeof(tok[count])); count++) ; /* we must get 6 tokens */ @@ -406,7 +406,7 @@ ljplus-2153 user priority 0 Jan 19 08:14 on ljplus ljplus-2154 user priority 0 Jan 19 08:14 from client (standard input) 7551 bytes ****************************************************************************/ -static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first) +static BOOL parse_lpq_hpux(char *line, print_queue_struct *buf, BOOL first) { /* must read two lines to process, therefore keep some values static */ static BOOL header_line_ok=False, base_prio_reset=False; @@ -418,9 +418,9 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first) /* to store minimum priority to print, lpstat command should be invoked with -p option first, to work */ static int base_prio; - int count; char htab = '\011'; + const char *cline = line; fstring tok[12]; /* If a line begins with a horizontal TAB, it is a subline type */ @@ -437,7 +437,7 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first) all_string_sub(line,"(","\"",0); all_string_sub(line,")","\"",0); - for (count=0; count<2 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ; + for (count=0; count<2 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ; /* we must get 2 tokens */ if (count < 2) return(False); @@ -473,7 +473,7 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first) /* handle the dash in the job id */ string_sub(line,"-"," ",0); - for (count=0; count<12 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ; + for (count=0; count<12 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ; /* we must get 8 tokens */ if (count < 8) return(False); @@ -519,6 +519,7 @@ static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first) fstring tok[9]; int count=0; char *p; + const char *cline = line; /* * Handle the dash in the job id, but make sure that we skip over @@ -542,7 +543,7 @@ static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first) if((p >= line) && (*p == '-')) *p = ' '; - for (count=0; count<9 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) + for (count=0; count<9 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ; /* we must get 7 tokens */ @@ -591,6 +592,7 @@ static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first) { fstring tok[7]; int count=0; + const char *cline; DEBUG(4,("antes [%s]\n", line)); @@ -605,9 +607,7 @@ static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first) string_sub(line,"]","",0); DEBUG(4,("despues 2 [%s]\n", line)); - - - for (count=0; count<7 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ; + for (count=0; count<7 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ; /* we must get 7 tokens */ if (count < 7) @@ -656,13 +656,14 @@ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first) { fstring tok[11]; int count=0; + const char *cline = line; /* handle the case of "(standard input)" as a filename */ string_sub(line,"stdin","STDIN",0); all_string_sub(line,"(","\"",0); all_string_sub(line,")","\"",0); - for (count=0; count<11 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ; + for (count=0; count<11 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ; /* we must get 11 tokens */ if (count < 11) @@ -726,11 +727,12 @@ static BOOL parse_lpq_softq(char *line,print_queue_struct *buf,BOOL first) { fstring tok[10]; int count=0; + const char *cline = line; /* mung all the ":"s to spaces*/ string_sub(line,":"," ",0); - for (count=0; count<10 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ; + for (count=0; count<10 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ; /* we must get 9 tokens */ if (count < 9) @@ -958,6 +960,7 @@ static BOOL parse_lpq_vlp(char *line,print_queue_struct *buf,BOOL first) { int toknum = 0; fstring tok; + const char *cline = line; /* First line is printer status */ @@ -965,7 +968,7 @@ static BOOL parse_lpq_vlp(char *line,print_queue_struct *buf,BOOL first) /* Parse a print job entry */ - while(next_token(&line, tok, NULL, sizeof(fstring))) { + while(next_token(&cline, tok, NULL, sizeof(fstring))) { switch (toknum) { case 0: buf->job = atoi(tok); @@ -997,6 +1000,7 @@ static BOOL parse_lpq_vlp(char *line,print_queue_struct *buf,BOOL first) /**************************************************************************** parse a lpq line. Choose printing style ****************************************************************************/ + BOOL parse_lpq_entry(int snum,char *line, print_queue_struct *buf, print_status_struct *status,BOOL first) diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index eaee3c26e7c..b5ad7987554 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -35,7 +35,6 @@ NTSTATUS cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal, NET_Q_REQ_CHAL q; NET_R_REQ_CHAL r; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - extern pstring global_myname; prs_init(&qbuf, MAX_PDU_FRAG_LEN, cli->mem_ctx, MARSHALL); prs_init(&rbuf, 0, cli->mem_ctx, UNMARSHALL); @@ -43,10 +42,10 @@ NTSTATUS cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal, /* create and send a MSRPC command with api NET_REQCHAL */ DEBUG(4,("cli_net_req_chal: LSA Request Challenge from %s to %s: %s\n", - global_myname, cli->desthost, credstr(clnt_chal->data))); + global_myname(), cli->desthost, credstr(clnt_chal->data))); /* store the parameters */ - init_q_req_chal(&q, cli->srv_name_slash, global_myname, clnt_chal); + init_q_req_chal(&q, cli->srv_name_slash, global_myname(), clnt_chal); /* Marshall data and send request */ @@ -92,7 +91,6 @@ NTSTATUS cli_net_auth2(struct cli_state *cli, NET_Q_AUTH_2 q; NET_R_AUTH_2 r; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - extern pstring global_myname; prs_init(&qbuf, MAX_PDU_FRAG_LEN, cli->mem_ctx, MARSHALL); prs_init(&rbuf, 0, cli->mem_ctx, UNMARSHALL); @@ -100,12 +98,12 @@ NTSTATUS cli_net_auth2(struct cli_state *cli, /* create and send a MSRPC command with api NET_AUTH2 */ DEBUG(4,("cli_net_auth2: srv:%s acct:%s sc:%x mc: %s chal %s neg: %x\n", - cli->srv_name_slash, cli->mach_acct, sec_chan, global_myname, + cli->srv_name_slash, cli->mach_acct, sec_chan, global_myname(), credstr(cli->clnt_cred.challenge.data), neg_flags)); /* store the parameters */ init_q_auth_2(&q, cli->srv_name_slash, cli->mach_acct, - sec_chan, global_myname, &cli->clnt_cred.challenge, + sec_chan, global_myname(), &cli->clnt_cred.challenge, neg_flags); /* turn parameters into data stream */ @@ -168,7 +166,6 @@ NTSTATUS cli_net_auth3(struct cli_state *cli, NET_Q_AUTH_3 q; NET_R_AUTH_3 r; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - extern pstring global_myname; prs_init(&qbuf, MAX_PDU_FRAG_LEN, cli->mem_ctx, MARSHALL); prs_init(&rbuf, 0, cli->mem_ctx, UNMARSHALL); @@ -176,12 +173,12 @@ NTSTATUS cli_net_auth3(struct cli_state *cli, /* create and send a MSRPC command with api NET_AUTH2 */ DEBUG(4,("cli_net_auth3: srv:%s acct:%s sc:%x mc: %s chal %s neg: %x\n", - cli->srv_name_slash, cli->mach_acct, sec_chan, global_myname, + cli->srv_name_slash, cli->mach_acct, sec_chan, global_myname(), credstr(cli->clnt_cred.challenge.data), *neg_flags)); /* store the parameters */ init_q_auth_3(&q, cli->srv_name_slash, cli->mach_acct, - sec_chan, global_myname, &cli->clnt_cred.challenge, + sec_chan, global_myname(), &cli->clnt_cred.challenge, *neg_flags); /* turn parameters into data stream */ @@ -500,7 +497,6 @@ NTSTATUS cli_netlogon_sam_logon(struct cli_state *cli, TALLOC_CTX *mem_ctx, NET_R_SAM_LOGON r; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; DOM_CRED clnt_creds, dummy_rtn_creds; - extern pstring global_myname; NET_ID_INFO_CTR ctr; NET_USER_INFO_3 user; int validation_level = 3; @@ -562,7 +558,7 @@ NTSTATUS cli_netlogon_sam_logon(struct cli_state *cli, TALLOC_CTX *mem_ctx, goto done; } - init_sam_info(&q.sam_id, cli->srv_name_slash, global_myname, + init_sam_info(&q.sam_id, cli->srv_name_slash, global_myname(), &clnt_creds, &dummy_rtn_creds, logon_type, &ctr); @@ -612,7 +608,6 @@ NTSTATUS cli_netlogon_sam_network_logon(struct cli_state *cli, TALLOC_CTX *mem_c NTSTATUS result = NT_STATUS_UNSUCCESSFUL; DOM_CRED clnt_creds, dummy_rtn_creds; NET_ID_INFO_CTR ctr; - extern pstring global_myname; int validation_level = 3; char *workstation_name_slash; @@ -648,7 +643,7 @@ NTSTATUS cli_netlogon_sam_network_logon(struct cli_state *cli, TALLOC_CTX *mem_c username, workstation_name_slash, (const uchar*)chal, lm_response.data, lm_response.length, nt_response.data, nt_response.length); - init_sam_info(&q.sam_id, cli->srv_name_slash, global_myname, + init_sam_info(&q.sam_id, cli->srv_name_slash, global_myname(), &clnt_creds, &dummy_rtn_creds, NET_LOGON_TYPE, &ctr); @@ -683,7 +678,7 @@ LSA Server Password Set. ****************************************************************************/ NTSTATUS cli_net_srv_pwset(struct cli_state *cli, TALLOC_CTX *mem_ctx, - char* machine_name, uint8 hashed_mach_pwd[16]) + const char *machine_name, uint8 hashed_mach_pwd[16]) { prs_struct rbuf; prs_struct qbuf; diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index f685f38754e..90f08148ef4 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -27,8 +27,6 @@ #define DBGC_CLASS DBGC_RPC_CLI extern struct pipe_id_info pipe_names[]; -extern fstring global_myworkgroup; -extern pstring global_myname; /******************************************************************** Rpc pipe call id. @@ -546,7 +544,7 @@ static BOOL rpc_api_pipe(struct cli_state *cli, prs_struct *data, prs_struct *rd static BOOL create_rpc_bind_req(prs_struct *rpc_out, BOOL do_auth, uint32 rpc_call_id, RPC_IFACE *abstract, RPC_IFACE *transfer, - char *my_name, char *domain, uint32 neg_flags) + const char *my_name, const char *domain, uint32 neg_flags) { RPC_HDR hdr; RPC_HDR_RB hdr_rb; @@ -640,7 +638,7 @@ static BOOL create_rpc_bind_req(prs_struct *rpc_out, BOOL do_auth, uint32 rpc_ca ********************************************************************/ static BOOL create_rpc_bind_resp(struct pwd_info *pwd, - char *domain, char *user_name, char *my_name, + const char *domain, const char *user_name, const char *my_name, uint32 ntlmssp_cli_flgs, uint32 rpc_call_id, prs_struct *rpc_out) @@ -1142,7 +1140,7 @@ static BOOL rpc_send_auth_reply(struct cli_state *cli, prs_struct *rdata, uint32 prs_give_memory( &rpc_out, buffer, sizeof(buffer), False); create_rpc_bind_resp(&cli->pwd, cli->domain, - cli->user_name, global_myname, + cli->user_name, global_myname(), cli->ntlmssp_cli_flgs, rpc_call_id, &rpc_out); @@ -1194,7 +1192,7 @@ static BOOL rpc_send_auth_reply(struct cli_state *cli, prs_struct *rdata, uint32 Do an rpc bind. ****************************************************************************/ -BOOL rpc_pipe_bind(struct cli_state *cli, const int pipe_idx, char *my_name) +BOOL rpc_pipe_bind(struct cli_state *cli, int pipe_idx, const char *my_name) { RPC_IFACE abstract; RPC_IFACE transfer; @@ -1225,7 +1223,7 @@ BOOL rpc_pipe_bind(struct cli_state *cli, const int pipe_idx, char *my_name) /* Marshall the outgoing data. */ create_rpc_bind_req(&rpc_out, do_auth, rpc_call_id, &abstract, &transfer, - global_myname, cli->domain, cli->ntlmssp_cli_flgs); + global_myname(), cli->domain, cli->ntlmssp_cli_flgs); /* Initialize the incoming data struct. */ prs_init(&rdata, 0, cli->mem_ctx, UNMARSHALL); @@ -1320,7 +1318,7 @@ BOOL cli_nt_session_open(struct cli_state *cli, const int pipe_idx) /******************* bind request on pipe *****************/ - if (!rpc_pipe_bind(cli, pipe_idx, global_myname)) { + if (!rpc_pipe_bind(cli, pipe_idx, global_myname())) { DEBUG(2,("cli_nt_session_open: rpc bind to %s failed\n", get_pipe_name_from_index(pipe_idx))); cli_close(cli, cli->nt_pipe_fnum); @@ -1336,10 +1334,10 @@ BOOL cli_nt_session_open(struct cli_state *cli, const int pipe_idx) strupper(cli->srv_name_slash); fstrcpy(cli->clnt_name_slash, "\\\\"); - fstrcat(cli->clnt_name_slash, global_myname); + fstrcat(cli->clnt_name_slash, global_myname()); strupper(cli->clnt_name_slash); - fstrcpy(cli->mach_acct, global_myname); + fstrcpy(cli->mach_acct, global_myname()); fstrcat(cli->mach_acct, "$"); strupper(cli->mach_acct); diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index c20fb855828..5dcb49d3994 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -244,14 +244,13 @@ BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) identauth >= 2^32 can be detected because it will be specified in hex ********************************************************************/ -void init_dom_sid(DOM_SID *sid, char *str_sid) +void init_dom_sid(DOM_SID *sid, const char *str_sid) { pstring domsid; int identauth; char *p; - if (str_sid == NULL) - { + if (str_sid == NULL) { DEBUG(4,("netlogon domain SID: none\n")); sid->sid_rev_num = 0; sid->num_auths = 0; @@ -592,7 +591,7 @@ void init_buffer3_uint32(BUFFER3 *str, uint32 val) Inits a BUFFER3 structure. ********************************************************************/ -void init_buffer3_str(BUFFER3 *str, char *buf, int len) +void init_buffer3_str(BUFFER3 *str, const char *buf, int len) { ZERO_STRUCTP(str); @@ -610,7 +609,7 @@ void init_buffer3_str(BUFFER3 *str, char *buf, int len) Inits a BUFFER3 structure from a hex string. ********************************************************************/ -void init_buffer3_hex(BUFFER3 *str, char *buf) +void init_buffer3_hex(BUFFER3 *str, const char *buf) { ZERO_STRUCTP(str); create_buffer3(str, strlen(buf)); @@ -697,7 +696,7 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) Inits a BUFFER2 structure. ********************************************************************/ -void init_buffer2(BUFFER2 *str, uint8 *buf, int len) +void init_buffer2(BUFFER2 *str, const uint8 *buf, int len) { ZERO_STRUCTP(str); @@ -963,7 +962,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) /******************************************************************* Inits a UNISTR2 structure from a UNISTR ********************************************************************/ -void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) +void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) { uint32 i; @@ -1138,7 +1137,7 @@ void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) Inits a DOM_CLNT_SRV structure. ********************************************************************/ -static void init_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) +static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char *comp_name) { DEBUG(5,("init_clnt_srv: %d\n", __LINE__)); @@ -1292,16 +1291,16 @@ BOOL smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) ********************************************************************/ void init_clnt_info2(DOM_CLNT_INFO2 *clnt, - char *logon_srv, char *comp_name, - DOM_CRED *clnt_cred) + const char *logon_srv, const char *comp_name, + const DOM_CRED *clnt_cred) { DEBUG(5,("make_clnt_info: %d\n", __LINE__)); - init_clnt_srv(&(clnt->login), logon_srv, comp_name); + init_clnt_srv(&clnt->login, logon_srv, comp_name); if (clnt_cred != NULL) { clnt->ptr_cred = 1; - memcpy(&(clnt->cred), clnt_cred, sizeof(clnt->cred)); + memcpy(&clnt->cred, clnt_cred, sizeof(clnt->cred)); } else { clnt->ptr_cred = 0; } @@ -1341,9 +1340,9 @@ BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int dep ********************************************************************/ void init_clnt_info(DOM_CLNT_INFO *clnt, - char *logon_srv, char *acct_name, - uint16 sec_chan, char *comp_name, - DOM_CRED *cred) + const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name, + const DOM_CRED *cred) { DEBUG(5,("make_clnt_info\n")); @@ -1413,7 +1412,7 @@ BOOL smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) Inits an OWF_INFO structure. ********************************************************************/ -void init_owf_info(OWF_INFO *hash, uint8 data[16]) +void init_owf_info(OWF_INFO *hash, const uint8 data[16]) { DEBUG(5,("init_owf_info: %d\n", __LINE__)); diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e0f710b2d75..c140a1fe019 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -134,7 +134,7 @@ static BOOL net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, ********************************************************************/ static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, - uint32 tc_status, char *trusted_dc_name) + uint32 tc_status, const char *trusted_dc_name) { int len_dc_name = strlen(trusted_dc_name); info->flags = flags; @@ -221,7 +221,7 @@ BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, in Inits an NET_Q_LOGON_CTRL2 structure. ********************************************************************/ -void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, char *srv_name, +void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, const char *srv_name, uint32 query_level) { DEBUG(5,("init_q_logon_ctrl2\n")); @@ -240,7 +240,7 @@ void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, char *srv_name, void init_net_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, uint32 flags, uint32 pdc_status, uint32 logon_attempts, uint32 tc_status, - char *trusted_domain_name) + const char *trusted_domain_name) { DEBUG(5,("init_r_logon_ctrl2\n")); @@ -352,7 +352,7 @@ BOOL net_io_q_logon_ctrl(char *desc, NET_Q_LOGON_CTRL *q_l, prs_struct *ps, Inits an NET_Q_LOGON_CTRL structure. ********************************************************************/ -void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, char *srv_name, +void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, const char *srv_name, uint32 query_level) { DEBUG(5,("init_q_logon_ctrl\n")); @@ -430,7 +430,7 @@ BOOL net_io_r_logon_ctrl(char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps, ********************************************************************/ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, - uint32 num_doms, char *dom_name) + uint32 num_doms, const char *dom_name) { int i = 0; @@ -791,8 +791,10 @@ BOOL net_io_r_auth_3(char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int depth) Inits a NET_Q_SRV_PWSET. ********************************************************************/ -void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *sess_key, char *acct_name, - uint16 sec_chan, char *comp_name, DOM_CRED *cred, uchar hashed_mach_pwd[16]) +void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, + const char *logon_srv, const char *sess_key, const char *acct_name, + uint16 sec_chan, const char *comp_name, + DOM_CRED *cred, uchar hashed_mach_pwd[16]) { unsigned char nt_cypher[16]; @@ -857,9 +859,9 @@ BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int de Init DOM_SID2 array from a string containing multiple sids *************************************************************************/ -static int init_dom_sid2s(TALLOC_CTX *ctx, char *sids_str, DOM_SID2 **ppsids) +static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsids) { - char *ptr; + const char *ptr; pstring s2; int count = 0; @@ -898,10 +900,10 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, char *sids_str, DOM_SID2 **ppsids) Inits a NET_ID_INFO_1 structure. ********************************************************************/ -void init_id_info1(NET_ID_INFO_1 *id, char *domain_name, +void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, - char *user_name, char *wksta_name, - char *sess_key, + const char *user_name, const char *wksta_name, + const char *sess_key, unsigned char lm_cypher[16], unsigned char nt_cypher[16]) { int len_domain_name = strlen(domain_name); @@ -1143,7 +1145,8 @@ static BOOL net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int ********************************************************************/ void init_sam_info(DOM_SAM_INFO *sam, - char *logon_srv, char *comp_name, DOM_CRED *clnt_cred, + const char *logon_srv, const char *comp_name, + DOM_CRED *clnt_cred, DOM_CRED *rtn_cred, uint16 logon_level, NET_ID_INFO_CTR *ctr) { @@ -1270,7 +1273,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, uint32 num_groups, const DOM_GID *gids, uint32 user_flgs, uchar *sess_key, const char *logon_srv, const char *logon_dom, - const DOM_SID *dom_sid, char *other_sids) + const DOM_SID *dom_sid, const char *other_sids) { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 247c83aecd5..e8825a2e14a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -697,7 +697,7 @@ BOOL smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, uint32 neg_flgs, - fstring myname, fstring domain) + const char *myname, const char *domain) { int len_myname = strlen(myname); int len_domain = strlen(domain); @@ -836,7 +836,7 @@ BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, uchar lm_resp[24], uchar nt_resp[24], - char *domain, char *user, char *wks, + const char *domain, const char *user, const char *wks, uint32 neg_flags) { uint32 offset; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 08ed28e80a4..d5ca78bda41 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -631,7 +631,7 @@ static BOOL sam_io_unk_info12(char *desc, SAM_UNK_INFO_12 * u_12, /******************************************************************* inits a structure. ********************************************************************/ -void init_unk_info5(SAM_UNK_INFO_5 * u_5,char *server) +void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server) { int len_server = strlen(server); @@ -666,7 +666,7 @@ static BOOL sam_io_unk_info5(char *desc, SAM_UNK_INFO_5 * u_5, inits a structure. ********************************************************************/ void init_unk_info2(SAM_UNK_INFO_2 * u_2, - char *domain, char *server, + const char *domain, const char *server, uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias) { int len_domain = strlen(domain); diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 672db36a288..b3d33645b90 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2686,7 +2686,7 @@ BOOL srv_io_r_net_file_close(char *desc, SRV_R_NET_FILE_CLOSE *q_n, Inits a SRV_INFO_100 structure. ********************************************************************/ -void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, char *name) +void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name) { DEBUG(5,("init_srv_info_100\n")); @@ -2725,9 +2725,9 @@ static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int Inits a SRV_INFO_101 structure. ********************************************************************/ -void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name, +void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name, uint32 ver_major, uint32 ver_minor, - uint32 srv_type, char *comment) + uint32 srv_type, const char *comment) { DEBUG(5,("init_srv_info_101\n")); @@ -2782,11 +2782,11 @@ static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int Inits a SRV_INFO_102 structure. ********************************************************************/ -void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, - char *comment, uint32 ver_major, uint32 ver_minor, +void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name, + const char *comment, uint32 ver_major, uint32 ver_minor, uint32 srv_type, uint32 users, uint32 disc, uint32 hidden, uint32 announce, uint32 ann_delta, uint32 licenses, - char *usr_path) + const char *usr_path) { DEBUG(5,("init_srv_info_102\n")); diff --git a/source3/rpc_server/srv_dfs.c b/source3/rpc_server/srv_dfs.c index 5edc1222a8d..676ad8e3f3f 100644 --- a/source3/rpc_server/srv_dfs.c +++ b/source3/rpc_server/srv_dfs.c @@ -31,8 +31,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -extern pstring global_myname; - /********************************************************************** api_dfs_exist **********************************************************************/ diff --git a/source3/rpc_server/srv_dfs_nt.c b/source3/rpc_server/srv_dfs_nt.c index 65e387176d3..da92e5c06b5 100644 --- a/source3/rpc_server/srv_dfs_nt.c +++ b/source3/rpc_server/srv_dfs_nt.c @@ -29,8 +29,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -extern pstring global_myname; - #define MAX_MSDFS_JUNCTIONS 256 /* This function does not return a WERROR or NTSTATUS code but rather 1 if @@ -197,7 +195,7 @@ static BOOL init_reply_dfs_info_1(struct junction_map* j, DFS_INFO_1* dfs1, int { pstring str; dfs1[i].ptr_entrypath = 1; - slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname, + slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname(), j[i].service_name, j[i].volume_name); DEBUG(5,("init_reply_dfs_info_1: %d) initing entrypath: %s\n",i,str)); init_unistr2(&dfs1[i].entrypath,str,strlen(str)+1); @@ -212,7 +210,7 @@ static BOOL init_reply_dfs_info_2(struct junction_map* j, DFS_INFO_2* dfs2, int { pstring str; dfs2[i].ptr_entrypath = 1; - slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname, + slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname(), j[i].service_name, j[i].volume_name); init_unistr2(&dfs2[i].entrypath, str, strlen(str)+1); dfs2[i].ptr_comment = 0; @@ -231,9 +229,9 @@ static BOOL init_reply_dfs_info_3(TALLOC_CTX *ctx, struct junction_map* j, DFS_I dfs3[i].ptr_entrypath = 1; if (j[i].volume_name[0] == '\0') slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s", - global_myname, j[i].service_name); + global_myname(), j[i].service_name); else - slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname, + slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname(), j[i].service_name, j[i].volume_name); init_unistr2(&dfs3[i].entrypath, str, strlen(str)+1); diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index c4fc0a5de75..fc51d7ef2fc 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -30,13 +30,11 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -extern fstring global_myworkgroup; -extern pstring global_myname; extern PRIVS privs[]; struct lsa_info { - DOM_SID sid; - uint32 access; + DOM_SID sid; + uint32 access; }; struct generic_mapping lsa_generic_mapping = { @@ -61,7 +59,7 @@ static void free_lsa_info(void *ptr) Init dom_query ***************************************************************************/ -static void init_dom_query(DOM_QUERY *d_q, char *dom_name, DOM_SID *dom_sid) +static void init_dom_query(DOM_QUERY *d_q, const char *dom_name, DOM_SID *dom_sid) { int domlen = (dom_name != NULL) ? strlen(dom_name) : 0; @@ -343,10 +341,11 @@ static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *s } /*************************************************************************** - init_dns_dom_info. - ***************************************************************************/ -static void init_dns_dom_info(LSA_DNS_DOM_INFO *r_l, char *nb_name, - char *dns_name, char *forest_name, + Init_dns_dom_info. +***************************************************************************/ + +static void init_dns_dom_info(LSA_DNS_DOM_INFO *r_l, const char *nb_name, + const char *dns_name, const char *forest_name, GUID *dom_guid, DOM_SID *dom_sid) { if (nb_name && *nb_name) { @@ -513,7 +512,7 @@ NTSTATUS _lsa_query_info(pipes_struct *p, LSA_Q_QUERY_INFO *q_u, LSA_R_QUERY_INF struct lsa_info *handle; LSA_INFO_UNION *info = &r_u->dom; DOM_SID domain_sid; - char *name = NULL; + const char *name; DOM_SID *sid = NULL; r_u->status = NT_STATUS_OK; @@ -548,20 +547,19 @@ NTSTATUS _lsa_query_info(pipes_struct *p, LSA_Q_QUERY_INFO *q_u, LSA_R_QUERY_INF switch (lp_server_role()) { case ROLE_DOMAIN_PDC: case ROLE_DOMAIN_BDC: - name = global_myworkgroup; + name = lp_workgroup(); sid = get_global_sam_sid(); break; case ROLE_DOMAIN_MEMBER: - name = global_myworkgroup; + name = lp_workgroup(); /* We need to return the Domain SID here. */ - if (secrets_fetch_domain_sid(global_myworkgroup, - &domain_sid)) + if (secrets_fetch_domain_sid(lp_workgroup(), &domain_sid)) sid = &domain_sid; else return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; break; case ROLE_STANDALONE: - name = global_myworkgroup; + name = lp_workgroup(); sid = NULL; break; default: @@ -578,15 +576,15 @@ NTSTATUS _lsa_query_info(pipes_struct *p, LSA_Q_QUERY_INFO *q_u, LSA_R_QUERY_INF switch (lp_server_role()) { case ROLE_DOMAIN_PDC: case ROLE_DOMAIN_BDC: - name = global_myworkgroup; + name = lp_workgroup(); sid = get_global_sam_sid(); break; case ROLE_DOMAIN_MEMBER: - name = global_myname; + name = global_myname(); sid = get_global_sam_sid(); break; case ROLE_STANDALONE: - name = global_myname; + name = global_myname(); sid = get_global_sam_sid(); break; default: @@ -1214,7 +1212,7 @@ NTSTATUS _lsa_query_secobj(pipes_struct *p, LSA_Q_QUERY_SEC_OBJ *q_u, LSA_R_QUER NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_INFO2 *r_u) { struct lsa_info *handle; - char *nb_name = NULL; + const char *nb_name; char *dns_name = NULL; char *forest_name = NULL; DOM_SID *sid = NULL; @@ -1236,13 +1234,12 @@ NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_I switch (lp_server_role()) { case ROLE_DOMAIN_PDC: case ROLE_DOMAIN_BDC: - nb_name = global_myworkgroup; + nb_name = lp_workgroup(); /* ugly temp hack for these next two */ dns_name = lp_realm(); forest_name = lp_realm(); sid = get_global_sam_sid(); - secrets_fetch_domain_guid(global_myworkgroup, - &guid); + secrets_fetch_domain_guid(lp_workgroup(), &guid); break; default: return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index 69d619a2b04..12841a2e087 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -29,8 +29,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -extern pstring global_myname; - /************************************************************************* init_net_r_req_chal: *************************************************************************/ @@ -687,8 +685,7 @@ NTSTATUS _net_sam_logon(pipes_struct *p, NET_Q_SAM_LOGON *q_u, NET_R_SAM_LOGON * return NT_STATUS_UNSUCCESSFUL; } - pstrcpy(my_name, global_myname); - strupper(my_name); + pstrcpy(my_name, global_myname()); /* * This is the point at which we get the group diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 66556e3acbe..ba5e9b70d32 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -34,8 +34,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -extern fstring global_myworkgroup; -extern pstring global_myname; extern DOM_SID global_sid_Builtin; extern rid_name domain_group_rids[]; @@ -2135,7 +2133,7 @@ NTSTATUS _samr_query_dom_info(pipes_struct *p, SAMR_Q_QUERY_DOMAIN_INFO *q_u, SA free_samr_db(info); /* The time call below is to get a sequence number for the sam. FIXME !!! JRA. */ - init_unk_info2(&ctr->info.inf2, global_myworkgroup, global_myname, (uint32) time(NULL), + init_unk_info2(&ctr->info.inf2, lp_workgroup(), global_myname(), (uint32) time(NULL), num_users, num_groups, num_aliases); break; case 0x03: @@ -2145,7 +2143,7 @@ NTSTATUS _samr_query_dom_info(pipes_struct *p, SAMR_Q_QUERY_DOMAIN_INFO *q_u, SA init_unk_info3(&ctr->info.inf3, nt_logout); break; case 0x05: - init_unk_info5(&ctr->info.inf5, global_myname); + init_unk_info5(&ctr->info.inf5, global_myname()); break; case 0x06: init_unk_info6(&ctr->info.inf6); @@ -2576,7 +2574,7 @@ NTSTATUS _samr_enum_domains(pipes_struct *p, SAMR_Q_ENUM_DOMAINS *q_u, SAMR_R_EN struct samr_info *info; uint32 num_entries = 2; fstring dom[2]; - char *name; + const char *name; r_u->status = NT_STATUS_OK; @@ -2590,10 +2588,10 @@ NTSTATUS _samr_enum_domains(pipes_struct *p, SAMR_Q_ENUM_DOMAINS *q_u, SAMR_R_EN switch (lp_server_role()) { case ROLE_DOMAIN_PDC: case ROLE_DOMAIN_BDC: - name = global_myworkgroup; + name = lp_workgroup(); break; default: - name = global_myname; + name = global_myname(); } fstrcpy(dom[0],name); @@ -4325,7 +4323,7 @@ NTSTATUS _samr_unknown_2e(pipes_struct *p, SAMR_Q_UNKNOWN_2E *q_u, SAMR_R_UNKNOW free_samr_db(info); /* The time call below is to get a sequence number for the sam. FIXME !!! JRA. */ - init_unk_info2(&ctr->info.inf2, global_myworkgroup, global_myname, (uint32) time(NULL), + init_unk_info2(&ctr->info.inf2, lp_workgroup(), global_myname(), (uint32) time(NULL), num_users, num_groups, num_aliases); break; case 0x03: @@ -4337,7 +4335,7 @@ NTSTATUS _samr_unknown_2e(pipes_struct *p, SAMR_Q_UNKNOWN_2E *q_u, SAMR_R_UNKNOW init_unk_info3(&ctr->info.inf3, nt_logout); break; case 0x05: - init_unk_info5(&ctr->info.inf5, global_myname); + init_unk_info5(&ctr->info.inf5, global_myname()); break; case 0x06: init_unk_info6(&ctr->info.inf6); diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 871aac8e68e..ad55ea6a49f 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -2332,8 +2332,6 @@ done: static BOOL spoolss_connect_to_client(struct cli_state *the_cli, const char *remote_machine) { - extern pstring global_myname; - ZERO_STRUCTP(the_cli); if(cli_initialise(the_cli) == NULL) { DEBUG(0,("connect_to_client: unable to initialize client connection.\n")); @@ -2358,7 +2356,7 @@ static BOOL spoolss_connect_to_client(struct cli_state *the_cli, const char *rem return False; } - if (!attempt_netbios_session_request(the_cli, global_myname, remote_machine, &the_cli->dest_ip)) { + if (!attempt_netbios_session_request(the_cli, global_myname(), remote_machine, &the_cli->dest_ip)) { DEBUG(0,("connect_to_client: machine %s rejected the NetBIOS session request.\n", remote_machine)); cli_shutdown(the_cli); diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index ecde51df9f9..0384bb81a33 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -27,8 +27,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -extern pstring global_myname; - /******************************************************************* Utility function to get the 'type' of a share from an snum. ********************************************************************/ @@ -1211,7 +1209,7 @@ WERROR _srv_net_srv_get_info(pipes_struct *p, SRV_Q_NET_SRV_GET_INFO *q_u, SRV_R case 102: init_srv_info_102(&ctr->srv.sv102, - 500, global_myname, + 500, global_myname(), string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH), lp_major_announce_version(), lp_minor_announce_version(), lp_default_server_announce(), @@ -1225,13 +1223,13 @@ WERROR _srv_net_srv_get_info(pipes_struct *p, SRV_Q_NET_SRV_GET_INFO *q_u, SRV_R break; case 101: init_srv_info_101(&ctr->srv.sv101, - 500, global_myname, + 500, global_myname(), lp_major_announce_version(), lp_minor_announce_version(), lp_default_server_announce(), string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH)); break; case 100: - init_srv_info_100(&ctr->srv.sv100, 500, global_myname); + init_srv_info_100(&ctr->srv.sv100, 500, global_myname()); break; default: status = WERR_UNKNOWN_LEVEL; diff --git a/source3/rpc_server/srv_wkssvc_nt.c b/source3/rpc_server/srv_wkssvc_nt.c index 7687e7b00af..bda7b14a422 100644 --- a/source3/rpc_server/srv_wkssvc_nt.c +++ b/source3/rpc_server/srv_wkssvc_nt.c @@ -28,8 +28,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -extern pstring global_myname; - /******************************************************************* create_wks_info_100 ********************************************************************/ @@ -41,7 +39,7 @@ static void create_wks_info_100(WKS_INFO_100 *inf) DEBUG(5,("create_wks_info_100: %d\n", __LINE__)); - pstrcpy (my_name, global_myname); + pstrcpy (my_name, global_myname()); strupper(my_name); pstrcpy (domain, lp_workgroup()); diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index e23140bdb00..646a6d90356 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -435,7 +435,8 @@ static void add_command_set(struct cmd_set *cmd_set) static NTSTATUS do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry, char *cmd) { - char *p = cmd, **argv = NULL; + char **argv = NULL; + const char *p = cmd; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; pstring buf; int argc = 0, i; @@ -528,7 +529,7 @@ static NTSTATUS process_cmd(struct cli_state *cli, char *cmd) struct cmd_list *temp_list; BOOL found = False; pstring buf; - char *p = cmd; + const char *p = cmd; NTSTATUS result = NT_STATUS_OK; int len = 0; @@ -578,7 +579,6 @@ static NTSTATUS process_cmd(struct cli_state *cli, char *cmd) int main(int argc, char *argv[]) { - extern pstring global_myname; static int got_pass = 0; BOOL interactive = True; int opt; @@ -694,8 +694,8 @@ static NTSTATUS process_cmd(struct cli_state *cli, char *cmd) load_interfaces(); - get_myname((*global_myname)?NULL:global_myname); - strupper(global_myname); + if (!init_names()) + return 1; /* Resolve the IP address */ @@ -719,7 +719,7 @@ static NTSTATUS process_cmd(struct cli_state *cli, char *cmd) if (!strlen(username) && !got_pass) get_username(username); - nt_status = cli_full_connection(&cli, global_myname, server, + nt_status = cli_full_connection(&cli, global_myname(), server, &server_ip, 0, "IPC$", "IPC", username, domain, diff --git a/source3/script/mkproto.awk b/source3/script/mkproto.awk index 196715d6b19..9acdf374f1f 100644 --- a/source3/script/mkproto.awk +++ b/source3/script/mkproto.awk @@ -64,7 +64,7 @@ END { /^FN_LOCAL_LIST/ { split($0,a,"[,()]") - printf "char **%s(int );\n", a[2] + printf "const char **%s(int );\n", a[2] } /^FN_LOCAL_STRING/ { @@ -94,7 +94,7 @@ END { /^FN_GLOBAL_LIST/ { split($0,a,"[,()]") - printf "char **%s(void);\n", a[2] + printf "const char **%s(void);\n", a[2] } /^FN_GLOBAL_STRING/ { diff --git a/source3/smbd/change_trust_pw.c b/source3/smbd/change_trust_pw.c index 4811083c2da..28a004eba88 100644 --- a/source3/smbd/change_trust_pw.c +++ b/source3/smbd/change_trust_pw.c @@ -24,13 +24,11 @@ #include "includes.h" -extern pstring global_myname; - /********************************************************* Change the domain password on the PDC. **********************************************************/ -static NTSTATUS modify_trust_password( char *domain, char *remote_machine, +static NTSTATUS modify_trust_password( const char *domain, const char *remote_machine, unsigned char orig_trust_passwd_hash[16]) { struct cli_state *cli; @@ -46,7 +44,7 @@ static NTSTATUS modify_trust_password( char *domain, char *remote_machine, return NT_STATUS_UNSUCCESSFUL; } - if (!NT_STATUS_IS_OK(cli_full_connection(&cli, global_myname, remote_machine, + if (!NT_STATUS_IS_OK(cli_full_connection(&cli, global_myname(), remote_machine, NULL, 0, "IPC$", "IPC", "", "", @@ -82,7 +80,7 @@ machine %s. Error was : %s.\n", remote_machine, cli_errstr(cli))); Change the trust account password for a domain. ************************************************************************/ -NTSTATUS change_trust_account_password( char *domain, char *remote_machine_list) +NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine_list) { fstring remote_machine; unsigned char old_trust_passwd_hash[16]; @@ -117,7 +115,7 @@ account password for domain %s.\n", domain)); * address used as a string. */ - if(!lookup_dc_name(global_myname, domain, &pdc_ip, dc_name)) + if(!lookup_dc_name(global_myname(), domain, &pdc_ip, dc_name)) continue; if(NT_STATUS_IS_OK(res = modify_trust_password( domain, dc_name, old_trust_passwd_hash))) diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index a5274862fc3..c2a82d1eb6c 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -290,7 +290,7 @@ static void pwd_sub(char *buf) all_string_sub(buf, "\\t", "\t", 0); } -static int talktochild(int master, char *seq) +static int talktochild(int master, const char *seq) { int count = 0; fstring issue, expected; diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 7ab1be9dd9d..6a031dde6f8 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -33,8 +33,6 @@ #define CHECK_TYPES 0 extern fstring local_machine; -extern pstring global_myname; -extern fstring global_myworkgroup; #define NERR_Success 0 #define NERR_badpass 86 @@ -960,7 +958,7 @@ struct srv_info_struct ******************************************************************/ static int get_server_info(uint32 servertype, struct srv_info_struct **servers, - char *domain) + const char *domain) { int count=0; int alloced=0; @@ -985,7 +983,7 @@ static int get_server_info(uint32 servertype, for (i=0;lines[i];i++) { fstring stype; struct srv_info_struct *s; - char *ptr = lines[i]; + const char *ptr = lines[i]; BOOL ok = True; if (!*ptr) continue; @@ -1010,7 +1008,7 @@ static int get_server_info(uint32 servertype, if (!next_token(&ptr,s->comment, NULL, sizeof(s->comment))) continue; if (!next_token(&ptr,s->domain , NULL, sizeof(s->domain))) { /* this allows us to cope with an old nmbd */ - pstrcpy(s->domain,global_myworkgroup); + pstrcpy(s->domain,lp_workgroup()); } if (sscanf(stype,"%X",&s->type) != 1) { @@ -1206,7 +1204,7 @@ static BOOL api_RNetServerEnum(connection_struct *conn, uint16 vuid, char *param if (strcmp(str1, "WrLehDz") == 0) { pull_ascii_fstring(domain, p); } else { - fstrcpy(domain, global_myworkgroup); + fstrcpy(domain, lp_workgroup()); } if (lp_browse_list()) @@ -2311,7 +2309,7 @@ static BOOL api_RNetServerGetInfo(connection_struct *conn,uint16 vuid, char *par pstrcpy(comment,string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH)); - if ((count=get_server_info(SV_TYPE_ALL,&servers,global_myworkgroup))>0) { + if ((count=get_server_info(SV_TYPE_ALL,&servers,lp_workgroup()))>0) { for (i=0;ilogon_script ? vuser->logon_script :""); /* script path */ diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 06a55cb33ea..b91c0c0866b 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -22,7 +22,6 @@ extern int Protocol; extern int max_recv; -extern fstring global_myworkgroup; BOOL global_encrypted_passwords_negotiated = False; BOOL global_spnego_negotiated = False; struct auth_context *negprot_global_auth_context = NULL; @@ -168,7 +167,6 @@ static int reply_lanman2(char *inbuf, char *outbuf) static int negprot_spnego(char *p) { DATA_BLOB blob; - extern pstring global_myname; uint8 guid[16]; const char *OIDs_krb5[] = {OID_KERBEROS5, OID_KERBEROS5_OLD, @@ -181,7 +179,7 @@ static int negprot_spnego(char *p) global_spnego_negotiated = True; memset(guid, 0, 16); - safe_strcpy((char *)guid, global_myname, 16); + safe_strcpy((char *)guid, global_myname(), 16); strlower((char *)guid); #if 0 @@ -292,7 +290,7 @@ static int reply_nt1(char *inbuf, char *outbuf) SSVALS(outbuf,smb_vwv16+1,8); p += 8; } - p += srvstr_push(outbuf, p, global_myworkgroup, -1, + p += srvstr_push(outbuf, p, lp_workgroup(), -1, STR_UNICODE|STR_TERMINATE|STR_NOALIGN); DEBUG(3,("not using SPNEGO\n")); } else { diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 1e87065e313..4ce99e96bbe 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -257,23 +257,25 @@ BOOL user_ok(const char *user,int snum) if (lp_invalid_users(snum)) { str_list_copy(&invalid, lp_invalid_users(snum)); if (invalid && str_list_substitute(invalid, "%S", lp_servicename(snum))) { - ret = !user_in_list(user, invalid); + ret = !user_in_list(user, (const char **)invalid); } } - if (invalid) str_list_free (&invalid); + if (invalid) + str_list_free (&invalid); if (ret && lp_valid_users(snum)) { str_list_copy(&valid, lp_valid_users(snum)); if (valid && str_list_substitute(valid, "%S", lp_servicename(snum))) { - ret = user_in_list(user,valid); + ret = user_in_list(user, (const char **)valid); } } - if (valid) str_list_free (&valid); + if (valid) + str_list_free (&valid); if (ret && lp_onlyuser(snum)) { char **user_list = str_list_make (lp_username(snum), NULL); if (user_list && str_list_substitute(user_list, "%S", lp_servicename(snum))) { - ret = user_in_list(user, user_list); + ret = user_in_list(user, (const char **)user_list); } if (user_list) str_list_free (&user_list); } diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 0f7cfd0e9cb..c46c4c5509c 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -45,8 +45,6 @@ extern int smb_read_error; SIG_ATOMIC_T reload_after_sighup = 0; SIG_ATOMIC_T got_sig_term = 0; extern BOOL global_machine_password_needs_changing; -extern fstring global_myworkgroup; -extern pstring global_myname; extern int max_send; /**************************************************************************** @@ -1154,16 +1152,16 @@ static BOOL timeout_processing(int deadtime, int *select_timeout, time_t *last_t * First, open the machine password file with an exclusive lock. */ - if (secrets_lock_trust_account_password(global_myworkgroup, True) == False) { + if (secrets_lock_trust_account_password(lp_workgroup(), True) == False) { DEBUG(0,("process: unable to lock the machine account password for \ -machine %s in domain %s.\n", global_myname, global_myworkgroup )); +machine %s in domain %s.\n", global_myname(), lp_workgroup() )); return True; } - if(!secrets_fetch_trust_account_password(global_myworkgroup, trust_passwd_hash, &lct)) { + if(!secrets_fetch_trust_account_password(lp_workgroup(), trust_passwd_hash, &lct)) { DEBUG(0,("process: unable to read the machine account password for \ -machine %s in domain %s.\n", global_myname, global_myworkgroup )); - secrets_lock_trust_account_password(global_myworkgroup, False); +machine %s in domain %s.\n", global_myname(), lp_workgroup() )); + secrets_lock_trust_account_password(lp_workgroup(), False); return True; } @@ -1173,15 +1171,15 @@ machine %s in domain %s.\n", global_myname, global_myworkgroup )); if(t < lct + lp_machine_password_timeout()) { global_machine_password_needs_changing = False; - secrets_lock_trust_account_password(global_myworkgroup, False); + secrets_lock_trust_account_password(lp_workgroup(), False); return True; } pstrcpy(remote_machine_list, lp_passwordserver()); - change_trust_account_password( global_myworkgroup, remote_machine_list); + change_trust_account_password( lp_workgroup(), remote_machine_list); global_machine_password_needs_changing = False; - secrets_lock_trust_account_password(global_myworkgroup, False); + secrets_lock_trust_account_password(lp_workgroup(), False); } /* diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 3371d9b5441..2c29ffdf51f 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -33,7 +33,6 @@ extern char magic_char; extern BOOL case_sensitive; extern BOOL case_preserve; extern BOOL short_case_preserve; -extern pstring global_myname; extern int global_oplock_break; unsigned int smb_echo_count = 0; @@ -356,7 +355,7 @@ int reply_ioctl(connection_struct *conn, { uint16 rap_jobid = pjobid_to_rap(SNUM(fsp->conn), fsp->print_jobid); SSVAL(p,0,rap_jobid); /* Job number */ - srvstr_push(outbuf, p+2, global_myname, 15, STR_TERMINATE|STR_ASCII); + srvstr_push(outbuf, p+2, global_myname(), 15, STR_TERMINATE|STR_ASCII); srvstr_push(outbuf, p+18, lp_servicename(SNUM(conn)), 13, STR_TERMINATE|STR_ASCII); break; } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 3d9a4675b2b..342c7c85cff 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -22,9 +22,6 @@ #include "includes.h" -extern fstring global_myworkgroup; -extern pstring global_myname; - int am_parent = 1; /* the last message the was processed */ @@ -200,7 +197,7 @@ static BOOL open_sockets_smbd(BOOL is_daemon,const char *smb_ports) for(i = 0; i < num_interfaces; i++) { struct in_addr *ifip = iface_n_ip(i); fstring tok; - char *ptr; + const char *ptr; if(ifip == NULL) { DEBUG(0,("open_sockets_smbd: interface %d has NULL IP address !\n", i)); @@ -237,7 +234,7 @@ static BOOL open_sockets_smbd(BOOL is_daemon,const char *smb_ports) from anywhere. */ fstring tok; - char *ptr; + const char *ptr; num_interfaces = 1; @@ -582,22 +579,15 @@ void exit_server(char *reason) Initialise connect, service and file structs. ****************************************************************************/ -static void init_structs(void ) +static BOOL init_structs(void ) { /* * Set the machine NETBIOS name if not already * set from the config file. */ - if (!*global_myname) { - char *p; - pstrcpy( global_myname, myhostname() ); - p = strchr_m(global_myname, '.' ); - if (p) - *p = 0; - } - - strupper(global_myname); + if (!init_names()) + return False; conn_init(); @@ -610,6 +600,7 @@ static void init_structs(void ) secrets_init(); + return True; } /**************************************************************************** @@ -740,8 +731,6 @@ static void init_structs(void ) } #endif - fstrcpy(global_myworkgroup, lp_workgroup()); - DEBUG(3,( "loaded services\n")); if (!is_daemon && !is_a_socket(0)) { diff --git a/source3/smbd/service.c b/source3/smbd/service.c index a8a590da804..16e0ad4160f 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -271,7 +271,7 @@ static void set_read_only(connection_struct *conn) if (!str_list_substitute(list, "%S", service)) { DEBUG(0, ("ERROR: read list substitution failed\n")); } - if (user_in_list(conn->user, list)) + if (user_in_list(conn->user, (const char **)list)) conn->read_only = True; str_list_free(&list); } @@ -281,7 +281,7 @@ static void set_read_only(connection_struct *conn) if (!str_list_substitute(list, "%S", service)) { DEBUG(0, ("ERROR: write list substitution failed\n")); } - if (user_in_list(conn->user, list)) + if (user_in_list(conn->user, (const char **)list)) conn->read_only = False; str_list_free(&list); } diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index b9af7200089..4ab1063217e 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -247,7 +247,6 @@ static int reply_spnego_negotiate(connection_struct *conn, const uint8 *cryptkey; BOOL got_kerberos = False; NTSTATUS nt_status; - extern pstring global_myname; char *cliname=NULL, *domname=NULL; /* parse out the OIDs and the first sec blob */ @@ -325,14 +324,14 @@ static int reply_spnego_negotiate(connection_struct *conn, fstrcpy(dnsdomname, (SEC_ADS == lp_security())?lp_realm():""); strlower(dnsdomname); - fstrcpy(dnsname, global_myname); + fstrcpy(dnsname, global_myname()); fstrcat(dnsname, "."); fstrcat(dnsname, dnsdomname); strlower(dnsname); msrpc_gen(&struct_blob, "aaaaa", 2, lp_workgroup(), - 1, global_myname, + 1, global_myname(), 4, dnsdomname, 3, dnsname, 0, ""); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 8b9728d513e..a2627021d9e 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -28,7 +28,6 @@ extern int smb_read_error; extern fstring local_machine; extern int global_oplock_break; extern uint32 global_client_caps; -extern pstring global_myname; #define get_file_size(sbuf) (sbuf.st_size) @@ -3021,7 +3020,7 @@ static int call_trans2ioctl(connection_struct *conn, char* inbuf, rap_jobid = pjobid_to_rap(SNUM(fsp->conn), fsp->print_jobid); /* Job number */ SSVAL(pdata,0,rap_jobid); /* Job number */ - srvstr_push( outbuf, pdata + 2, global_myname, 15, STR_ASCII|STR_TERMINATE); /* Our NetBIOS name */ + srvstr_push( outbuf, pdata + 2, global_myname(), 15, STR_ASCII|STR_TERMINATE); /* Our NetBIOS name */ srvstr_push( outbuf, pdata+18, lp_servicename(SNUM(conn)), 13, STR_ASCII|STR_TERMINATE); /* Service name */ send_trans2_replies(outbuf,bufsize,*pparams,0,*ppdata,32); return(-1); diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 48b9768358e..e2cc26e0aec 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -445,8 +445,6 @@ void add_supplementary_nt_login_groups(int *n_groups, gid_t **pp_groups, NT_USER BOOL lookup_name(const char *domain, const char *name, DOM_SID *psid, enum SID_NAME_USE *name_type) { - extern pstring global_myname; - extern fstring global_myworkgroup; fstring sid; BOOL local_lookup = False; @@ -455,11 +453,11 @@ BOOL lookup_name(const char *domain, const char *name, DOM_SID *psid, enum SID_N /* If we are looking up a domain user, make sure it is for the local machine only */ - if (strequal(global_myname, domain)) { + if (strequal(global_myname(), domain)) { local_lookup = True; } else if (lp_server_role() == ROLE_DOMAIN_PDC || lp_server_role() == ROLE_DOMAIN_BDC) { - if (strequal(domain, global_myworkgroup)) { + if (strequal(domain, lp_workgroup())) { local_lookup = True; } } diff --git a/source3/utils/net.c b/source3/utils/net.c index 4b1a52992e4..ba08feae191 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -61,7 +61,7 @@ char *opt_host = NULL; char *opt_password = NULL; char *opt_user_name = NULL; BOOL opt_user_specified = False; -char *opt_workgroup = NULL; +const char *opt_workgroup = NULL; int opt_long_list_entries = 0; int opt_reboot = 0; int opt_force = 0; @@ -77,7 +77,6 @@ static int opt_machine_pass = 0; BOOL opt_have_ip = False; struct in_addr opt_dest_ip; -extern pstring global_myname; extern BOOL AllowDebugChange; /* @@ -188,7 +187,7 @@ BOOL net_find_server(unsigned flags, struct in_addr *server_ip, char **server_na if (is_zero_ip(pdc_ip)) return False; - if (!lookup_dc_name(global_myname, opt_target_workgroup, &pdc_ip, dc_name)) + if (!lookup_dc_name(global_myname(), opt_target_workgroup, &pdc_ip, dc_name)) return False; *server_name = strdup(dc_name); @@ -238,7 +237,7 @@ BOOL net_find_dc(struct in_addr *server_ip, fstring server_name, const char *dom if (is_zero_ip(*server_ip)) return False; - if (!lookup_dc_name(global_myname, domain_name, server_ip, dc_name)) + if (!lookup_dc_name(global_myname(), domain_name, server_ip, dc_name)) return False; safe_strcpy(server_name, dc_name, FSTRING_LEN); @@ -335,7 +334,7 @@ static int net_getlocalsid(int argc, const char **argv) name = argv[0]; } else { - name = global_myname; + name = global_myname(); } if (!secrets_fetch_domain_sid(name, &sid)) { @@ -359,7 +358,7 @@ static int net_setlocalsid(int argc, const char **argv) return 1; } - if (!secrets_store_domain_sid(global_myname, &sid)) { + if (!secrets_store_domain_sid(global_myname(), &sid)) { DEBUG(0,("Can't store domain SID as a pdc/bdc.\n")); return 1; } @@ -372,12 +371,12 @@ static int net_getdomainsid(int argc, const char **argv) DOM_SID domain_sid; fstring sid_str; - if (!secrets_fetch_domain_sid(global_myname, &domain_sid)) { + if (!secrets_fetch_domain_sid(global_myname(), &domain_sid)) { d_printf("Could not fetch local SID\n"); return 1; } sid_to_string(sid_str, &domain_sid); - d_printf("SID for domain %s is: %s\n", global_myname, sid_str); + d_printf("SID for domain %s is: %s\n", global_myname(), sid_str); if (!secrets_fetch_domain_sid(lp_workgroup(), &domain_sid)) { d_printf("Could not fetch domain SID\n"); @@ -607,19 +606,11 @@ static struct functable net_func[] = { } if (!opt_target_workgroup) { - opt_target_workgroup = lp_workgroup(); + opt_target_workgroup = strdup(lp_workgroup()); } - if (!*global_myname) { - char *p2; - - pstrcpy(global_myname, myhostname()); - p2 = strchr_m(global_myname, '.'); - if (p2) - *p2 = 0; - } - - strupper(global_myname); + if (!init_names()) + exit(1); load_interfaces(); @@ -632,7 +623,7 @@ static struct functable net_func[] = { exit(1); } - asprintf(&opt_user_name,"%s$", global_myname); + asprintf(&opt_user_name,"%s$", global_myname()); opt_password = secrets_fetch_machine_password(); if (!opt_password) { d_printf("ERROR: Unable to fetch machine password\n"); diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index af290ce83c6..b138f67aa35 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -513,19 +513,18 @@ static int net_ads_status(int argc, const char **argv) { ADS_STRUCT *ads; ADS_STATUS rc; - extern pstring global_myname; void *res; if (!(ads = ads_startup())) return -1; - rc = ads_find_machine_acct(ads, &res, global_myname); + rc = ads_find_machine_acct(ads, &res, global_myname()); if (!ADS_ERR_OK(rc)) { d_printf("ads_find_machine_acct: %s\n", ads_errstr(rc)); return -1; } if (ads_count_replies(ads, res) == 0) { - d_printf("No machine account for '%s' found\n", global_myname); + d_printf("No machine account for '%s' found\n", global_myname()); return -1; } @@ -538,7 +537,6 @@ static int net_ads_leave(int argc, const char **argv) { ADS_STRUCT *ads = NULL; ADS_STATUS rc; - extern pstring global_myname; if (!secrets_init()) { DEBUG(1,("Failed to initialise secrets database\n")); @@ -546,7 +544,7 @@ static int net_ads_leave(int argc, const char **argv) } if (!opt_password) { - asprintf(&opt_user_name, "%s$", global_myname); + asprintf(&opt_user_name, "%s$", global_myname()); opt_password = secrets_fetch_machine_password(); } @@ -554,14 +552,14 @@ static int net_ads_leave(int argc, const char **argv) return -1; } - rc = ads_leave_realm(ads, global_myname); + rc = ads_leave_realm(ads, global_myname()); if (!ADS_ERR_OK(rc)) { d_printf("Failed to delete host '%s' from the '%s' realm.\n", - global_myname, ads->config.realm); + global_myname(), ads->config.realm); return -1; } - d_printf("Removed '%s' from realm '%s'\n", global_myname, ads->config.realm); + d_printf("Removed '%s' from realm '%s'\n", global_myname(), ads->config.realm); return 0; } @@ -569,14 +567,13 @@ static int net_ads_leave(int argc, const char **argv) static int net_ads_join_ok(void) { ADS_STRUCT *ads = NULL; - extern pstring global_myname; if (!secrets_init()) { DEBUG(1,("Failed to initialise secrets database\n")); return -1; } - asprintf(&opt_user_name, "%s$", global_myname); + asprintf(&opt_user_name, "%s$", global_myname()); opt_password = secrets_fetch_machine_password(); if (!(ads = ads_startup())) { @@ -611,7 +608,6 @@ int net_ads_join(int argc, const char **argv) ADS_STATUS rc; char *password; char *tmp_password; - extern pstring global_myname; const char *org_unit = "Computers"; char *dn; void *res; @@ -649,7 +645,7 @@ int net_ads_join(int argc, const char **argv) return -1; } - rc = ads_join_realm(ads, global_myname, org_unit); + rc = ads_join_realm(ads, global_myname(), org_unit); if (!ADS_ERR_OK(rc)) { d_printf("ads_join_realm: %s\n", ads_errstr(rc)); return -1; @@ -661,7 +657,7 @@ int net_ads_join(int argc, const char **argv) return -1; } - rc = ads_set_machine_password(ads, global_myname, password); + rc = ads_set_machine_password(ads, global_myname(), password); if (!ADS_ERR_OK(rc)) { d_printf("ads_set_machine_password: %s\n", ads_errstr(rc)); return -1; @@ -677,7 +673,7 @@ int net_ads_join(int argc, const char **argv) return -1; } - d_printf("Joined '%s' to realm '%s'\n", global_myname, ads->config.realm); + d_printf("Joined '%s' to realm '%s'\n", global_myname(), ads->config.realm); free(password); @@ -704,7 +700,6 @@ static int net_ads_printer_info(int argc, const char **argv) ADS_STRUCT *ads; ADS_STATUS rc; const char *servername, *printername; - extern pstring global_myname; void *res = NULL; if (!(ads = ads_startup())) return -1; @@ -717,7 +712,7 @@ static int net_ads_printer_info(int argc, const char **argv) if (argc > 1) servername = argv[1]; else - servername = global_myname; + servername = global_myname(); rc = ads_find_printer_on_server(ads, &res, printername, servername); @@ -750,7 +745,6 @@ static int net_ads_printer_publish(int argc, const char **argv) ADS_STATUS rc; char *uncname, *servername; ADS_PRINTER_ENTRY prt; - extern pstring global_myname; char *ports[2] = {"Samba", NULL}; /* @@ -772,11 +766,11 @@ static int net_ads_printer_publish(int argc, const char **argv) get_a_printer, because the server name might be localhost or an ip address */ prt.printerName = argv[0]; - asprintf(&servername, "%s.%s", global_myname, ads->config.realm); + asprintf(&servername, "%s.%s", global_myname(), ads->config.realm); prt.serverName = servername; - prt.shortServerName = global_myname; + prt.shortServerName = global_myname(); prt.versionNumber = "4"; - asprintf(&uncname, "\\\\%s\\%s", global_myname, argv[0]); + asprintf(&uncname, "\\\\%s\\%s", global_myname(), argv[0]); prt.uNCName=uncname; prt.printBinNames = (char **) bins; prt.printMediaSupported = (char **) media; @@ -799,8 +793,8 @@ static int net_ads_printer_remove(int argc, const char **argv) { ADS_STRUCT *ads; ADS_STATUS rc; - char *servername, *prt_dn; - extern pstring global_myname; + const char *servername; + char *prt_dn; void *res = NULL; if (!(ads = ads_startup())) return -1; @@ -811,7 +805,7 @@ static int net_ads_printer_remove(int argc, const char **argv) if (argc > 1) servername = argv[1]; else - servername = global_myname; + servername = global_myname(); rc = ads_find_printer_on_server(ads, &res, argv[0], servername); @@ -902,7 +896,6 @@ static int net_ads_password(int argc, const char **argv) static int net_ads_change_localhost_pass(int argc, const char **argv) { ADS_STRUCT *ads; - extern pstring global_myname; char *host_principal; char *hostname; ADS_STATUS ret; @@ -912,14 +905,14 @@ static int net_ads_change_localhost_pass(int argc, const char **argv) return -1; } - asprintf(&opt_user_name, "%s$", global_myname); + asprintf(&opt_user_name, "%s$", global_myname()); opt_password = secrets_fetch_machine_password(); if (!(ads = ads_startup())) { return -1; } - hostname = strdup(global_myname); + hostname = strdup(global_myname()); strlower(hostname); asprintf(&host_principal, "%s@%s", hostname, ads->config.realm); SAFE_FREE(hostname); diff --git a/source3/utils/net_ads_cldap.c b/source3/utils/net_ads_cldap.c index 6821a5902e0..f81c763093f 100644 --- a/source3/utils/net_ads_cldap.c +++ b/source3/utils/net_ads_cldap.c @@ -232,7 +232,6 @@ int ads_cldap_netlogon(ADS_STRUCT *ads) { int sock; int ret; - extern pstring global_myname; struct cldap_netlogon_reply reply; sock = open_udp_socket(inet_ntoa(ads->ldap_ip), ads->ldap_port); @@ -243,7 +242,7 @@ int ads_cldap_netlogon(ADS_STRUCT *ads) return -1; } - ret = send_cldap_netlogon(sock, ads->config.realm, global_myname, 6); + ret = send_cldap_netlogon(sock, ads->config.realm, global_myname(), 6); if (ret != 0) { return ret; } diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index ae1e8dbbac5..16caa8d8615 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -21,8 +21,6 @@ #include "includes.h" #include "../utils/net.h" -extern pstring global_myname; - /** * @file net_rpc.c * @@ -240,12 +238,11 @@ static int rpc_changetrustpw(int argc, const char **argv) static NTSTATUS rpc_join_oldstyle_internals(const DOM_SID *domain_sid, struct cli_state *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { - extern pstring global_myname; fstring trust_passwd; unsigned char orig_trust_passwd_hash[16]; NTSTATUS result; - fstrcpy(trust_passwd, global_myname); + fstrcpy(trust_passwd, global_myname()); strlower(trust_passwd); /* @@ -432,7 +429,7 @@ rpc_getsid_internals(const DOM_SID *domain_sid, struct cli_state *cli, d_printf("Storing SID %s for Domain %s in secrets.tdb\n", sid_str, lp_workgroup()); - if (!secrets_store_domain_sid(global_myname, domain_sid)) { + if (!secrets_store_domain_sid(global_myname(), domain_sid)) { DEBUG(0,("Can't store domain SID\n")); return NT_STATUS_UNSUCCESSFUL; } @@ -1917,7 +1914,7 @@ static int rpc_trustdom_list(int argc, const char **argv) if (opt_target_workgroup) SAFE_FREE(opt_target_workgroup); opt_target_workgroup = opt_workgroup; } else { - safe_strcpy(pdc_name, global_myname, FSTRING_LEN); + safe_strcpy(pdc_name, global_myname(), FSTRING_LEN); domain_name = talloc_strdup(mem_ctx, lp_workgroup()); if (opt_target_workgroup) SAFE_FREE(opt_target_workgroup); opt_target_workgroup = domain_name; @@ -2165,7 +2162,7 @@ BOOL net_rpc_check(unsigned flags) if (!cli_connect(&cli, server_name, &server_ip)) goto done; - if (!attempt_netbios_session_request(&cli, global_myname, + if (!attempt_netbios_session_request(&cli, global_myname(), server_name, &server_ip)) goto done; if (!cli_negprot(&cli)) diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c index c209886ef17..4b78b7d283d 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -104,8 +104,6 @@ done: int net_rpc_join_newstyle(int argc, const char **argv) { - extern pstring global_myname; - /* libsmb variables */ struct cli_state *cli; @@ -187,7 +185,7 @@ int net_rpc_join_newstyle(int argc, const char **argv) "could not open domain"); /* Create domain user */ - acct_name = talloc_asprintf(mem_ctx, "%s$", global_myname); + acct_name = talloc_asprintf(mem_ctx, "%s$", global_myname()); strlower(acct_name); const_acct_name = acct_name; @@ -347,9 +345,7 @@ done: **/ int net_rpc_testjoin(int argc, const char **argv) { - char *domain = lp_workgroup(); - - domain = smb_xstrdup(domain); + char *domain = smb_xstrdup(lp_workgroup()); /* Display success or failure */ if (net_rpc_join_ok(domain) != 0) { diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c index 13c75c80b04..4cf923b1f76 100644 --- a/source3/utils/net_time.c +++ b/source3/utils/net_time.c @@ -28,7 +28,6 @@ static time_t cli_servertime(const char *host, struct in_addr *ip, int *zone) { struct nmb_name calling, called; time_t ret = 0; - extern pstring global_myname; struct cli_state *cli = NULL; cli = cli_initialise(NULL); @@ -39,7 +38,7 @@ static time_t cli_servertime(const char *host, struct in_addr *ip, int *zone) goto done; } - make_nmb_name(&calling, global_myname, 0x0); + make_nmb_name(&calling, global_myname(), 0x0); if (host) { make_nmb_name(&called, host, 0x20); } else { diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c index cdaa434e3c7..81061346997 100644 --- a/source3/utils/nmblookup.c +++ b/source3/utils/nmblookup.c @@ -246,12 +246,8 @@ int main(int argc,char *argv[]) translate_addresses = !translate_addresses; break; case 'i': - { - extern pstring global_scope; - pstrcpy(global_scope,optarg); - strupper(global_scope); - } - break; + set_global_scope(optarg); + break; case 'M': find_master = True; break; diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index 1199dec7fb3..6a019e73d71 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -50,7 +50,6 @@ #define MASK_ALWAYS_GOOD 0x0000001F #define MASK_USER_GOOD 0x00001F00 -extern pstring global_myname; /********************************************************* Add all currently available users to another db @@ -176,7 +175,7 @@ static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdst Get an Print User Info **********************************************************/ -static int print_user_info (struct pdb_context *in, char *username, BOOL verbosity, BOOL smbpwdstyle) +static int print_user_info (struct pdb_context *in, const char *username, BOOL verbosity, BOOL smbpwdstyle) { SAM_ACCOUNT *sam_pwent=NULL; BOOL ret; @@ -496,7 +495,7 @@ int main (int argc, char **argv) poptGetArg(pc); /* Drop argv[0], the program name */ if (user_name == NULL) { - user_name = poptGetArg(pc); + user_name = strdup(poptGetArg(pc)); } if (!lp_load(dyn_CONFIGFILE,True,False,False)) { @@ -504,16 +503,8 @@ int main (int argc, char **argv) exit(1); } - if (!*global_myname) { - char *p2; - - pstrcpy(global_myname, myhostname()); - p2 = strchr_m(global_myname, '.'); - if (p2) - *p2 = 0; - } - - strupper(global_myname); + if (!init_names()) + exit(1); setparms = (backend ? BIT_BACKEND : 0) + (verbose ? BIT_VERBOSE : 0) + diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 940187407cf..1d681a07f7b 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -42,9 +42,6 @@ enum acl_mode {SMB_ACL_SET, SMB_ACL_DELETE, SMB_ACL_MODIFY, SMB_ACL_ADD }; enum chown_mode {REQUEST_NONE, REQUEST_CHOWN, REQUEST_CHGRP}; enum exit_values {EXIT_OK, EXIT_FAILED, EXIT_PARSE_ERROR}; -extern pstring global_myname; -extern fstring global_myworkgroup; - struct perm_value { char *perm; uint32 mask; @@ -232,6 +229,7 @@ static void print_ace(FILE *f, SEC_ACE *ace) static BOOL parse_ace(SEC_ACE *ace, char *str) { char *p; + const char *cp; fstring tok; unsigned atype, aflags, amask; DOM_SID sid; @@ -243,7 +241,6 @@ static BOOL parse_ace(SEC_ACE *ace, char *str) if (!p) return False; *p = '\0'; p++; - /* Try to parse numeric form */ if (sscanf(p, "%i/%i/%i", &atype, &aflags, &amask) == 3 && @@ -257,7 +254,8 @@ static BOOL parse_ace(SEC_ACE *ace, char *str) return False; } - if (!next_token(&p, tok, "/", sizeof(fstring))) { + cp = p; + if (!next_token(&cp, tok, "/", sizeof(fstring))) { return False; } @@ -271,12 +269,12 @@ static BOOL parse_ace(SEC_ACE *ace, char *str) /* Only numeric form accepted for flags at present */ - if (!(next_token(&p, tok, "/", sizeof(fstring)) && + if (!(next_token(&cp, tok, "/", sizeof(fstring)) && sscanf(tok, "%i", &aflags))) { return False; } - if (!next_token(&p, tok, "/", sizeof(fstring))) { + if (!next_token(&cp, tok, "/", sizeof(fstring))) { return False; } @@ -342,7 +340,7 @@ static BOOL add_ace(SEC_ACL **the_acl, SEC_ACE *ace) /* parse a ascii version of a security descriptor */ static SEC_DESC *sec_desc_parse(char *str) { - char *p = str; + const char *p = str; fstring tok; SEC_DESC *ret; size_t sd_size; @@ -718,10 +716,10 @@ static struct cli_state *connect_one(char *share) } } - if (NT_STATUS_IS_OK(nt_status = cli_full_connection(&c, global_myname, server, + if (NT_STATUS_IS_OK(nt_status = cli_full_connection(&c, global_myname(), server, &ip, 0, share, "?????", - username, global_myworkgroup, + username, lp_workgroup(), password, 0, NULL))) { return c; } else { diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 7c292dd521c..034de91ce01 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -107,7 +107,7 @@ Prints out the current Debug level returned by MSG_DEBUGLEVEL ****************************************************************************/ void debuglevel_function(int msg_type, pid_t src, void *buf, size_t len) { - char *levels = (char *)buf; + const char *levels = (char *)buf; pstring dbgcl; printf("Current debug levels of PID %u are:\n",(unsigned int)src); diff --git a/source3/utils/smbgroupedit.c b/source3/utils/smbgroupedit.c index b5033e03846..0faa0513edb 100644 --- a/source3/utils/smbgroupedit.c +++ b/source3/utils/smbgroupedit.c @@ -21,9 +21,6 @@ #include "includes.h" -extern pstring global_myname; -extern fstring global_myworkgroup; - /* * Next two lines needed for SunOS and don't * hurt anything else... @@ -282,17 +279,8 @@ int main (int argc, char **argv) exit(1); } - if (!*global_myname) { - char *p; - pstrcpy( global_myname, myhostname() ); - p = strchr_m(global_myname, '.' ); - if (p) - *p = 0; - } - - strupper(global_myname); - - fstrcpy(global_myworkgroup, lp_workgroup()); + if (!init_names()) + exit(1); if(!initialize_password_db(True)) { fprintf(stderr, "Can't setup password database vectors.\n"); diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index 0e822ee7ade..d9f36119f7c 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -19,7 +19,6 @@ #include "includes.h" -extern pstring global_myname; extern BOOL AllowDebugChange; /* @@ -585,13 +584,8 @@ int main(int argc, char **argv) * set from the config file. */ - if (!*global_myname) { - char *p; - fstrcpy(global_myname, myhostname()); - p = strchr_m(global_myname, '.' ); - if (p) *p = 0; - } - strupper(global_myname); + if (!init_names()) + return 1; /* Check the effective uid - make sure we are not setuid */ if (is_setuid_root()) { diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index 280a7b8853f..d30bd916b27 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -121,7 +121,7 @@ parameter.\n" ); } else { pstring passwd_prog; pstring truncated_prog; - char *p; + const char *p; pstrcpy( passwd_prog, lp_passwd_program()); p = passwd_prog; @@ -250,8 +250,8 @@ int main(int argc, const char *argv[]) for (s=0;s<1000;s++) { if (VALID_SNUM(s)) { - char **deny_list = lp_hostsdeny(s); - char **allow_list = lp_hostsallow(s); + const char **deny_list = lp_hostsdeny(s); + const char **allow_list = lp_hostsallow(s); int i; if(deny_list) { for (i=0; deny_list[i]; i++) { diff --git a/source3/wrepld/server.c b/source3/wrepld/server.c index f08674afbb2..295eb15596a 100644 --- a/source3/wrepld/server.c +++ b/source3/wrepld/server.c @@ -21,9 +21,6 @@ #include "includes.h" #include "wins_repl.h" -extern fstring global_myworkgroup; -extern pstring global_myname; - extern pstring user_socket_options; extern WINS_OWNER *global_wins_table; @@ -163,29 +160,9 @@ void exit_server(char *reason) } /**************************************************************************** - initialise connect, service and file structs + Usage of the program. ****************************************************************************/ -static void init_structs(void ) -{ - /* - * Set the machine NETBIOS name if not already - * set from the config file. - */ - - if (!*global_myname) { - char *p; - fstrcpy( global_myname, myhostname() ); - p = strchr_m( global_myname, '.' ); - if (p) - *p = 0; - } - strupper( global_myname ); -} - -/**************************************************************************** -usage on the program -****************************************************************************/ static void usage(char *pname) { @@ -684,7 +661,8 @@ static void process(void) if (!reload_services(False)) return(-1); - init_structs(); + if (!init_names()) + return -1; #ifdef WITH_PROFILE if (!profile_setup(False)) { @@ -693,8 +671,6 @@ static void process(void) } #endif - fstrcpy(global_myworkgroup, lp_workgroup()); - CatchSignal(SIGHUP,SIGNAL_CAST sig_hup); DEBUG(3,( "loaded services\n")); -- cgit From db7377977c6a9dddc49ee4ef02c9e12e85632ff3 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 13 Nov 2002 01:22:25 +0000 Subject: - Add some more warning flags for --enable-developer. - patch from SUSE for hiemdal headers in /usr/include/heimdal (This used to be commit 1dbc9eff149ca976ff5edb5c256fa2fe6b409617) --- source3/configure.in | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source3/configure.in b/source3/configure.in index 47856eaec31..3f36cb87f12 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -161,12 +161,12 @@ AC_ARG_ENABLE(debug, AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)], [if eval "test x$enable_developer = xyes"; then - CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER" + CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wfloat-equal -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wdisabled-optimization -DDEBUG_PASSWORD -DDEVELOPER" fi]) AC_ARG_ENABLE(krb5developer, [ --enable-krb5developer Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)], [if eval "test x$enable_krb5developer = xyes"; then - CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER" + CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wfloat-equal -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wdisabled-optimization -DDEBUG_PASSWORD -DDEVELOPER" fi]) AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc Enable heap debugging [default=no]]) @@ -1987,6 +1987,20 @@ if test x"$with_ads_support" = x"yes"; then ) +if test x$FOUND_KRB5 = x"no"; then +################################################# +# see if this box has the SuSE location for the heimdal kerberos implementation +AC_MSG_CHECKING(for /usr/include/heimdal) +if test -d /usr/include/heimdal; then + CFLAGS="$CFLAGS -I/usr/heimdal/include" + CPPFLAGS="$CPPFLAGS -I/usr/heimdal/include" + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +fi + + if test x$FOUND_KRB5 = x"no"; then ################################################# # see if this box has the RedHat location for kerberos -- cgit From c8d96f887d417de4ce5f249f93ac659055a05ea2 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Wed, 13 Nov 2002 01:54:44 +0000 Subject: Bring smbmount.c in line with jra's global-cide. global_scope was used here... (This used to be commit 5170a9f7ffac93c619358353834bc3024a6746d2) --- source3/client/smbmount.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index a29ab48ecee..d8f5e1b394f 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -681,7 +681,6 @@ static void parse_mount_smb(int argc, char **argv) char *opteq; extern char *optarg; int val; - extern pstring global_scope; char *p; if (argc < 2 || argv[1][0] == '-') { @@ -762,7 +761,7 @@ static void parse_mount_smb(int argc, char **argv) } else if(!strcmp(opts, "sockopt")) { pstrcpy(user_socket_options,opteq+1); } else if(!strcmp(opts, "scope")) { - pstrcpy(global_scope,opteq+1); + pstrcpy(global_scope(),opteq+1); } else { slprintf(p, sizeof(pstring) - (p - options) - 1, "%s=%s,", opts, opteq+1); p += strlen(p); -- cgit From 2bd37f8565363f53ba8ba0d68cd47429ccaa2991 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 13 Nov 2002 02:21:55 +0000 Subject: Sorry Jim we can't assign to global_xxx(), we need to call set_global_xxx() to ensure the malloc is done. Jeremy. (This used to be commit e57853000aacc61ba3c73907a7afb85385b378c3) --- source3/client/smbmount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index d8f5e1b394f..33adfc4d488 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -761,7 +761,7 @@ static void parse_mount_smb(int argc, char **argv) } else if(!strcmp(opts, "sockopt")) { pstrcpy(user_socket_options,opteq+1); } else if(!strcmp(opts, "scope")) { - pstrcpy(global_scope(),opteq+1); + set_global_scope(opteq+1); } else { slprintf(p, sizeof(pstring) - (p - options) - 1, "%s=%s,", opts, opteq+1); p += strlen(p); -- cgit From 6de53c67564f298aaf50426de3e9199a04c4885e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 13 Nov 2002 04:14:21 +0000 Subject: Undo the new --enable-developer flags that caused breakage on gcc != 3.2, and rerun autoconf (This used to be commit 6da20cd7638b5e36af080a4b8ae8880035fe684b) --- source3/configure | 2127 ++++++++++++++++++++++++++++++++++++++------------ source3/configure.in | 4 +- 2 files changed, 1642 insertions(+), 489 deletions(-) diff --git a/source3/configure b/source3/configure index a04d3a5c1e6..73baed25441 100755 --- a/source3/configure +++ b/source3/configure @@ -1,11 +1,19 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.54. +# Generated by GNU Autoconf 2.53. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + + ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -14,13 +22,11 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +# NLS nuisances. # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset @@ -28,39 +34,34 @@ else as_unset=false fi - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } # Name of the executable. -as_me=`$as_basename "$0" || +as_me=`(basename "$0") 2>/dev/null || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ @@ -71,7 +72,6 @@ echo X/"$0" | /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -85,7 +85,7 @@ if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh - if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: @@ -138,8 +138,6 @@ do as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} @@ -212,12 +210,6 @@ else fi rm -f conf$$ conf$$.exe conf$$.file -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. @@ -234,7 +226,7 @@ as_nl=' IFS=" $as_nl" # CDPATH. -$as_unset CDPATH +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } # Name of the host. @@ -248,7 +240,6 @@ exec 6>&1 # Initializations. # ac_default_prefix=/usr/local -ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= @@ -306,8 +297,6 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configdir lockdir piddir logfilebase privatedir swatdir RUNPROG MPROGS LDSHFLAGS SONAMEFLAG SHLD HOST_OS PAM_MOD WRAP WRAP32 WRAPPROG PICFLAG PICSUFFIX POBAD_CC SHLIBEXT LIBSMBCLIENT_SHARED LIBSMBCLIENT PRINTLIBS AUTHLIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK BROKEN_CC build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CPP EGREP CUPS_CONFIG LIBOBJS TERMLIBS TERMLDFLAGS ROFF DYNEXP MYSQL_CONFIG MYSQL_CFLAGS MYSQL_LIBS XML2_CONFIG XML_CFLAGS XML_LIBS QUOTAOBJS manlangs WINBIND_TARGETS WINBIND_STARGETS WINBIND_LTARGETS WINBIND_PAM_TARGETS WINBIND_NSS_EXTRA_OBJS WINBIND_NSS_EXTRA_LIBS BUILD_POPT FLAGS1 PYTHON builddir LTLIBOBJS' -ac_subst_files='' # Initialize some variables set by options. ac_init_help= @@ -731,9 +720,6 @@ if test ! -r $srcdir/$ac_unique_file; then { (exit 1); exit 1; }; } fi fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias @@ -942,7 +928,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -982,7 +968,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.54. Invocation command line was +generated by GNU Autoconf 2.53. Invocation command line was $ $0 $@ @@ -1048,9 +1034,12 @@ do *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + esac # Get rid of the leading space. - ac_sep=" " done # When interrupted or exit'd, cleanup temporary files, and complete @@ -1062,7 +1051,6 @@ trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo - cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## @@ -1085,35 +1073,6 @@ _ASBOX esac; } echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## @@ -1121,7 +1080,7 @@ _ASBOX ## ----------- ## _ASBOX echo - sed "/^$/d" confdefs.h | sort + sed "/^$/d" confdefs.h echo fi test "$ac_signal" != 0 && @@ -1278,8 +1237,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - ac_config_headers="$ac_config_headers include/config.h" +ac_config_headers="$ac_config_headers include/config.h" ################################################# @@ -1708,7 +1666,9 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + set dummy "$as_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" fi fi fi @@ -1841,6 +1801,12 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -1869,10 +1835,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.*; do - test -f "$ac_file" || continue +for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; a.out ) # We found the default executable, but exeext='' is most # certainly right. break;; @@ -1886,10 +1853,8 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -check \`config.log' for details." >&5 -echo "$as_me: error: C compiler cannot create executables -check \`config.log' for details." >&2;} +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi @@ -1946,10 +1911,9 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; @@ -1978,6 +1942,12 @@ else #line $LINENO "configure" #include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -1994,7 +1964,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac @@ -2022,6 +1992,12 @@ else #line $LINENO "configure" #include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2070,6 +2046,12 @@ else #line $LINENO "configure" #include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2115,97 +2097,6 @@ else CFLAGS= fi fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide @@ -2241,6 +2132,12 @@ do #include "confdefs.h" #include $ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2272,6 +2169,12 @@ rm -f conftest.$ac_objext conftest.$ac_ext #line $LINENO "configure" #include "confdefs.h" $ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2496,6 +2399,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strerror (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2536,6 +2445,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strerror (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2591,6 +2506,12 @@ else #line $LINENO "configure" #include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2679,6 +2600,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3065,7 +2992,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) SINIX_LFS_SUPPORT=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CPPFLAGS="$old_CPPFLAGS" if test x$SINIX_LFS_SUPPORT = xyes ; then @@ -3152,7 +3079,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) LINUX_LFS_SUPPORT=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CPPFLAGS="$old_CPPFLAGS" if test x$LINUX_LFS_SUPPORT = xyes ; then @@ -3217,7 +3144,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) GLIBC_LFS_SUPPORT=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CPPFLAGS="$old_CPPFLAGS" if test x$GLIBC_LFS_SUPPORT = xyes ; then @@ -3239,6 +3166,103 @@ echo "${ECHO_T}$GLIBC_LFS_SUPPORT" >&6 esac +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + echo "$as_me:$LINENO: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6 if test "${ac_cv_c_inline+set}" = set; then @@ -3250,9 +3274,8 @@ for ac_kw in inline __inline__ __inline; do #line $LINENO "configure" #include "confdefs.h" #ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } +static $ac_kw int static_foo () {return 0; } +$ac_kw int foo () {return 0; } #endif _ACEOF @@ -3326,7 +3349,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3359,7 +3382,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3417,7 +3440,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3450,7 +3473,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3493,21 +3516,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then @@ -3525,7 +3533,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3556,7 +3564,7 @@ if test $ac_cv_header_stdc = yes; then _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then + egrep "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no @@ -3574,7 +3582,7 @@ if test $ac_cv_header_stdc = yes; then _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then + egrep "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no @@ -3633,7 +3641,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -3666,6 +3674,12 @@ else #include #include <$ac_hdr> +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3726,6 +3740,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3766,6 +3786,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3823,6 +3849,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3863,6 +3895,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3915,6 +3953,12 @@ else #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3971,6 +4015,12 @@ else # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -4129,7 +4179,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4249,7 +4299,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4367,7 +4417,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4487,7 +4537,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4608,7 +4658,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4727,7 +4777,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4846,7 +4896,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4964,7 +5014,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5079,7 +5129,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5149,6 +5199,12 @@ case "$host_os" in #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -5244,7 +5300,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5363,7 +5419,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5478,7 +5534,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5594,7 +5650,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5710,7 +5766,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5828,7 +5884,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5944,7 +6000,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -6060,7 +6116,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -6129,6 +6185,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6179,6 +6241,12 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6207,6 +6275,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6249,6 +6323,12 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6277,6 +6357,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6327,6 +6413,12 @@ while test "x$ac_lo" != "x$ac_hi"; do #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6377,6 +6469,12 @@ long longval () { return (long) (sizeof (int)); } unsigned long ulongval () { return (long) (sizeof (int)); } #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6425,7 +6523,7 @@ cat conftest.$ac_ext >&5 echo "$as_me: error: cannot compute sizeof (int), 77" >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -6449,6 +6547,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6499,6 +6603,12 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6527,6 +6637,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6569,6 +6685,12 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6597,6 +6719,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6647,6 +6775,12 @@ while test "x$ac_lo" != "x$ac_hi"; do #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6697,6 +6831,12 @@ long longval () { return (long) (sizeof (long)); } unsigned long ulongval () { return (long) (sizeof (long)); } #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6745,7 +6885,7 @@ cat conftest.$ac_ext >&5 echo "$as_me: error: cannot compute sizeof (long), 77" >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -6769,6 +6909,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6819,6 +6965,12 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6847,6 +6999,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6889,6 +7047,12 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6917,6 +7081,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -6967,6 +7137,12 @@ while test "x$ac_lo" != "x$ac_hi"; do #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7017,6 +7193,12 @@ long longval () { return (long) (sizeof (short)); } unsigned long ulongval () { return (long) (sizeof (short)); } #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7065,7 +7247,7 @@ cat conftest.$ac_ext >&5 echo "$as_me: error: cannot compute sizeof (short), 77" >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -7090,6 +7272,12 @@ else #line $LINENO "configure" #include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7185,9 +7373,8 @@ for ac_kw in inline __inline__ __inline; do #line $LINENO "configure" #include "confdefs.h" #ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } +static $ac_kw int static_foo () {return 0; } +$ac_kw int foo () {return 0; } #endif _ACEOF @@ -7239,6 +7426,12 @@ cat >conftest.$ac_ext <<_ACEOF #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7269,6 +7462,12 @@ cat >conftest.$ac_ext <<_ACEOF #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7304,7 +7503,7 @@ else cat conftest.$ac_ext >&5 # It does not; compile a test program. if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file + # try to guess the endianess by grep'ing values into an object file ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" @@ -7315,6 +7514,12 @@ void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7335,10 +7540,10 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + if fgrep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi -if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then +if fgrep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else @@ -7387,7 +7592,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -7404,9 +7609,9 @@ _ACEOF no) ;; *) - { { echo "$as_me:$LINENO: error: unknown endianness + { { echo "$as_me:$LINENO: error: unknown endianess presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -echo "$as_me: error: unknown endianness +echo "$as_me: error: unknown endianess presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac @@ -7421,6 +7626,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7480,6 +7691,12 @@ extern "C" void (*signal (int, void (*)(int)))(int); void (*signal ()) (); #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7528,7 +7745,7 @@ else _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1; then + egrep "uid_t" >/dev/null 2>&1; then ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no @@ -7560,6 +7777,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7612,6 +7835,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7664,6 +7893,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7716,6 +7951,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7747,63 +7988,39 @@ ac_cv_type_pid_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -echo "${ECHO_T}$ac_cv_type_pid_t" >&6 -if test $ac_cv_type_pid_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF - -fi - - -echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5 -echo $ECHO_N "checking for struct stat.st_rdev... $ECHO_C" >&6 -if test "${ac_cv_member_struct_stat_st_rdev+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -$ac_includes_default -int -main () -{ -static struct stat ac_aggr; -if (ac_aggr.st_rdev) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_member_struct_stat_st_rdev=yes +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5 +echo $ECHO_N "checking for struct stat.st_rdev... $ECHO_C" >&6 +if test "${ac_cv_member_struct_stat_st_rdev+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { static struct stat ac_aggr; -if (sizeof ac_aggr.st_rdev) +if (ac_aggr.st_rdev) return 0; ; return 0; @@ -7829,8 +8046,6 @@ ac_cv_member_struct_stat_st_rdev=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5 echo "${ECHO_T}$ac_cv_member_struct_stat_st_rdev" >&6 if test $ac_cv_member_struct_stat_st_rdev = yes; then @@ -7859,6 +8074,12 @@ else #include #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7906,6 +8127,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -7958,6 +8185,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8010,6 +8243,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8062,6 +8301,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8114,6 +8359,12 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8246,6 +8497,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8311,6 +8568,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8367,6 +8630,12 @@ else #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8432,6 +8701,12 @@ else #include #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8490,6 +8765,12 @@ else #include #endif #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8544,6 +8825,12 @@ else #include #endif #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8594,6 +8881,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8643,6 +8936,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8692,6 +8991,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8741,6 +9046,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8790,6 +9101,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8839,6 +9156,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8888,6 +9211,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -8963,7 +9292,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_have_setresuid=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_have_setresuid" >&5 @@ -9013,7 +9342,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_have_setresgid=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_have_setresgid" >&5 @@ -9038,6 +9367,12 @@ else #line $LINENO "configure" #include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -9089,7 +9424,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_memcmp_working=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 @@ -9123,6 +9458,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -9188,6 +9529,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char crypt (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -9304,7 +9651,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -9418,7 +9765,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -9534,7 +9881,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -9609,6 +9956,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tgetent (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -9663,6 +10016,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char rl_callback_handler_install (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -9785,7 +10144,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -9899,7 +10258,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -10015,7 +10374,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -10090,6 +10449,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tgetent (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10144,6 +10509,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char rl_callback_handler_install (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10227,6 +10598,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char rl_completion_matches (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10297,6 +10674,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10365,6 +10748,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char printf (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10427,6 +10816,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char printf (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10489,6 +10884,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10551,6 +10952,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10630,6 +11037,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10695,6 +11108,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yp_get_default_domain (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10762,6 +11181,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10856,6 +11281,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -10936,6 +11367,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11016,6 +11453,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11094,6 +11537,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11171,6 +11620,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11250,6 +11705,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11327,6 +11788,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11403,6 +11870,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11483,6 +11956,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11556,6 +12035,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11627,6 +12112,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11699,6 +12190,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11776,6 +12273,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11852,6 +12355,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11923,6 +12432,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -11995,6 +12510,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12070,6 +12591,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12147,6 +12674,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12222,6 +12755,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12298,6 +12837,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12371,6 +12916,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12446,6 +12997,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12522,6 +13079,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12597,6 +13160,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12672,6 +13241,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12745,6 +13320,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12808,6 +13389,12 @@ echo $ECHO_N "checking for stat64 in ... $ECHO_C" >&6 #endif #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12857,6 +13444,12 @@ echo $ECHO_N "checking for lstat64 in ... $ECHO_C" >&6 #endif #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12905,6 +13498,12 @@ echo $ECHO_N "checking for fstat64 in ... $ECHO_C" >&6 #endif #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -12963,6 +13562,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dn_expand (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13035,6 +13640,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13100,6 +13711,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char putprpwnam (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13164,6 +13781,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13238,6 +13861,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13303,6 +13932,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char putprpwnam (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13367,6 +14002,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13442,6 +14083,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13507,6 +14154,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char set_auth_parameters (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13571,6 +14224,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13645,6 +14304,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13710,6 +14375,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char set_auth_parameters (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13774,6 +14445,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13850,6 +14527,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13915,6 +14598,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getspnam (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -13979,6 +14668,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14054,6 +14749,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14119,6 +14820,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getspnam (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14183,6 +14890,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14257,6 +14970,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14322,6 +15041,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getspnam (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14386,6 +15111,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14461,6 +15192,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14526,6 +15263,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char bigcrypt (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14590,6 +15333,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14664,6 +15413,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14729,6 +15484,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char bigcrypt (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14793,6 +15554,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14868,6 +15635,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14933,6 +15706,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getprpwnam (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -14997,6 +15776,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -15071,6 +15856,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -15136,6 +15927,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getprpwnam (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -15200,6 +15997,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -15603,7 +16406,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_have_longlong=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_have_longlong" >&5 @@ -15630,6 +16433,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -15704,7 +16513,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_SIZEOF_OFF_T=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_SIZEOF_OFF_T" >&5 @@ -15756,7 +16565,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_OFF64_T=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_OFF64_T" >&5 @@ -15804,7 +16613,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_SIZEOF_INO_T=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_SIZEOF_INO_T" >&5 @@ -15856,7 +16665,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_INO64_T=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_INO64_T" >&5 @@ -15908,7 +16717,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_DEV64_T=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_DEV64_T" >&5 @@ -15936,6 +16745,12 @@ cat >conftest.$ac_ext <<_ACEOF #endif #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16012,7 +16827,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_DEVICE_MAJOR_FN=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_DEVICE_MAJOR_FN" >&5 @@ -16063,7 +16878,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_DEVICE_MINOR_FN=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_DEVICE_MINOR_FN" >&5 @@ -16110,7 +16925,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_UNSIGNED_CHAR=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_UNSIGNED_CHAR" >&5 @@ -16135,6 +16950,12 @@ cat >conftest.$ac_ext <<_ACEOF #include #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16185,6 +17006,12 @@ cat >conftest.$ac_ext <<_ACEOF #include #include void seekdir(DIR *d, long loc) { return; } +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16233,6 +17060,12 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16281,6 +17114,12 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16355,7 +17194,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_GETTIMEOFDAY_TZ=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_GETTIMEOFDAY_TZ" >&5 @@ -16379,6 +17218,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include va_list ap1,ap2; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16473,7 +17318,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_C99_VSNPRINTF=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_C99_VSNPRINTF" >&5 @@ -16523,7 +17368,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_BROKEN_READDIR=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_BROKEN_READDIR" >&5 @@ -16547,6 +17392,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16614,6 +17465,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16672,6 +17529,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16721,6 +17584,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16770,6 +17639,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16819,6 +17694,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16868,6 +17749,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16917,6 +17804,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -16966,6 +17859,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17015,6 +17914,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17064,6 +17969,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17113,6 +18024,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17163,6 +18080,12 @@ else #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17213,6 +18136,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17289,6 +18218,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char iconv_open (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17385,7 +18320,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_NATIVE_ICONV=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_NATIVE_ICONV" >&5 @@ -17442,7 +18377,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" >&5 @@ -17498,7 +18433,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" >&5 @@ -17556,7 +18491,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_KERNEL_SHARE_MODES=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_KERNEL_SHARE_MODES" >&5 @@ -17583,6 +18518,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17665,7 +18606,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" >&5 @@ -17696,6 +18637,12 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPC_RPC_H) #include #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17747,6 +18694,12 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPC_RPC_H) #include #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17798,6 +18751,12 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPC_RPC_H) #include #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17849,6 +18808,12 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPC_RPC_H) #include #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17905,6 +18870,12 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPC_RPC_H) #include #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -17976,7 +18947,7 @@ cat conftest.$ac_ext >&5 echo "$as_me: error: cant find test code. Aborting config" >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: checking for ftruncate extend" >&5 @@ -18012,7 +18983,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_FTRUNCATE_EXTEND=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_FTRUNCATE_EXTEND" >&5 @@ -18058,7 +19029,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_WORKING_AF_LOCAL=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_WORKING_AF_LOCAL" >&5 @@ -18105,7 +19076,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_BROKEN_GETGROUPS=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_BROKEN_GETGROUPS" >&5 @@ -18136,6 +19107,12 @@ cat >conftest.$ac_ext <<_ACEOF #include "${srcdir-.}/lib/getsmbpass.c" #undef main +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -18219,7 +19196,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_REPLACE_INET_NTOA=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_REPLACE_INET_NTOA" >&5 @@ -18278,7 +19255,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_SECURE_MKSTEMP=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_SECURE_MKSTEMP" >&5 @@ -18325,7 +19302,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_SYSCONF_SC_NGROUPS_MAX=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_SYSCONF_SC_NGROUPS_MAX" >&5 @@ -18371,7 +19348,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_ROOT=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_ROOT" >&5 @@ -18427,7 +19404,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_IFACE_AIX=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_IFACE_AIX" >&5 @@ -18478,7 +19455,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_IFACE_IFCONF=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_IFACE_IFCONF" >&5 @@ -18530,7 +19507,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_IFACE_IFREQ=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_IFACE_IFREQ" >&5 @@ -18586,7 +19563,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_USE_SETRESUID=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_USE_SETRESUID" >&5 @@ -18639,7 +19616,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_USE_SETREUID=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_USE_SETREUID" >&5 @@ -18691,7 +19668,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_USE_SETEUID=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_USE_SETEUID" >&5 @@ -18743,7 +19720,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_USE_SETUIDX=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_USE_SETUIDX" >&5 @@ -18791,7 +19768,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_MMAP=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_MMAP" >&5 @@ -18837,7 +19814,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_FTRUNCATE_NEEDS_ROOT=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_FTRUNCATE_NEEDS_ROOT" >&5 @@ -18883,7 +19860,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_FCNTL_LOCK=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_FCNTL_LOCK" >&5 @@ -18929,7 +19906,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" >&5 @@ -18997,7 +19974,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_STRUCT_FLOCK64=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_STRUCT_FLOCK64" >&5 @@ -19024,6 +20001,12 @@ cat >conftest.$ac_ext <<_ACEOF #include #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -19074,6 +20057,12 @@ cat >conftest.$ac_ext <<_ACEOF #include #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -19131,6 +20120,12 @@ cat >conftest.$ac_ext <<_ACEOF #include #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -19184,6 +20179,12 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPCSVC_NIS_H) #include #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -19396,6 +20397,23 @@ echo "${ECHO_T}no" >&6 fi; +if test x$FOUND_KRB5 = x"no"; then +################################################# +# see if this box has the SuSE location for the heimdal kerberos implementation +echo "$as_me:$LINENO: checking for /usr/include/heimdal" >&5 +echo $ECHO_N "checking for /usr/include/heimdal... $ECHO_C" >&6 +if test -d /usr/include/heimdal; then + CFLAGS="$CFLAGS -I/usr/heimdal/include" + CPPFLAGS="$CPPFLAGS -I/usr/heimdal/include" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +fi + + if test x$FOUND_KRB5 = x"no"; then ################################################# # see if this box has the RedHat location for kerberos @@ -19472,7 +20490,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -19590,7 +20608,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -19670,6 +20688,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char _et_list (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -19723,6 +20747,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char krb5_encrypt_data (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -19780,6 +20810,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char krb5_mk_req_extended (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -19841,6 +20877,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gss_display_status (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -19927,6 +20969,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char ber_scanf (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -19984,6 +21032,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char ldap_domain2hostlist (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -20052,6 +21106,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -20110,6 +21170,12 @@ else #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -20334,7 +21400,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) no_mysql=yes fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" @@ -20371,6 +21437,12 @@ int main(int argc, char *argv[]) #undef main #define main K_and_R_C_main +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -20627,7 +21699,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) no_xml=yes fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" @@ -20660,6 +21732,12 @@ echo "${ECHO_T}no" >&6 #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -20835,6 +21913,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pam_get_data (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -20942,6 +22026,12 @@ extern "C" char $ac_func (); char (*f) (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -21007,6 +22097,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char crypt (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -21092,7 +22188,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_TRUNCATED_SALT=yes fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi LIBS="$crypt_LIBS" fi @@ -21356,6 +22452,12 @@ else #include #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -21569,7 +22671,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_statvfs64=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statvfs64" >&5 @@ -21602,6 +22704,12 @@ else #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -21685,7 +22793,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_statfs3_osf1=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -21750,7 +22858,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_statfs2_bsize=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -21806,7 +22914,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_statfs4=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -21868,7 +22976,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_statfs2_fsize=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -21934,7 +23042,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_fs_data=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -21970,6 +23078,12 @@ cat >conftest.$ac_ext <<_ACEOF __COMPILE_ERROR_ #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22143,6 +23257,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char acl_get_file (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22194,6 +23314,12 @@ else #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22243,6 +23369,12 @@ else #include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22333,6 +23465,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22379,6 +23517,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22430,6 +23574,12 @@ else #undef _FILE_OFFSET_BITS #endif #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22529,6 +23679,12 @@ else #include #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22607,6 +23763,12 @@ else \ #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22681,6 +23843,12 @@ else \ #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22757,6 +23925,12 @@ else #include "confdefs.h" \ #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -22839,6 +24013,12 @@ else #include "confdefs.h" \ #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -23041,6 +24221,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -23093,6 +24279,12 @@ else #line $LINENO "configure" #include "confdefs.h" #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -23167,6 +24359,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char poptGetContext (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -23287,7 +24485,7 @@ cat conftest.$ac_ext >&5 echo "$as_me: error: summary failure. Aborting config" >&2;} { (exit 1); exit 1; }; }; exit 1; fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi builddir=`pwd` @@ -23296,7 +24494,7 @@ builddir=`pwd` # I added make files that are outside /source directory. # I know this is not a good solution, will work out a better # solution soon. --simo - ac_config_files="$ac_config_files include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/sam/Makefile" +ac_config_files="$ac_config_files include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/sam/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -23307,7 +24505,7 @@ cat >confcache <<\_ACEOF # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # -# `ac_cv_env_foo' variables (set or unset) will be overridden when +# `ac_cv_env_foo' variables (set or unset) will be overriden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. @@ -23373,21 +24571,6 @@ fi DEFS=-DHAVE_CONFIG_H -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -23406,6 +24589,7 @@ SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF + ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -23414,13 +24598,11 @@ cat >>$CONFIG_STATUS <<\_ACEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +# NLS nuisances. # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset @@ -23428,39 +24610,34 @@ else as_unset=false fi - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } # Name of the executable. -as_me=`$as_basename "$0" || +as_me=`(basename "$0") 2>/dev/null || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ @@ -23471,7 +24648,6 @@ echo X/"$0" | /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -23485,7 +24661,7 @@ if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh - if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: @@ -23539,8 +24715,6 @@ do as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} @@ -23614,12 +24788,6 @@ else fi rm -f conf$$ conf$$.exe conf$$.file -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. @@ -23636,7 +24804,7 @@ as_nl=' IFS=" $as_nl" # CDPATH. -$as_unset CDPATH +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } exec 6>&1 @@ -23653,7 +24821,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by $as_me, which was -generated by GNU Autoconf 2.54. Invocation command line was +generated by GNU Autoconf 2.53. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -23712,7 +24880,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.54, +configured by $0, generated by GNU Autoconf 2.53, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 @@ -23733,20 +24901,17 @@ do --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift ;; + -*);; *) # This is not an option, so the user has probably given explicit # arguments. - ac_option=$1 ac_need_defaults=false;; esac - case $ac_option in + case $1 in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<_ACEOF @@ -23769,12 +24934,12 @@ Try \`$0 --help' for more information." >&2;} --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + shift + CONFIG_FILES="$CONFIG_FILES $1" ac_need_defaults=false;; --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" ac_need_defaults=false;; # This is an error. @@ -23937,7 +25102,6 @@ s,@target_cpu@,$target_cpu,;t t s,@target_vendor@,$target_vendor,;t t s,@target_os@,$target_os,;t t s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t s,@CUPS_CONFIG@,$CUPS_CONFIG,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@TERMLIBS@,$TERMLIBS,;t t @@ -23962,7 +25126,6 @@ s,@BUILD_POPT@,$BUILD_POPT,;t t s,@FLAGS1@,$FLAGS1,;t t s,@PYTHON@,$PYTHON,;t t s,@builddir@,$builddir,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF @@ -24033,30 +25196,25 @@ echo X"$ac_file" | /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } ac_builddir=. @@ -24086,7 +25244,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -24276,7 +25434,7 @@ _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail @@ -24300,7 +25458,7 @@ do mv conftest.tail conftest.defines done rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS +echo ' fi # egrep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size @@ -24356,30 +25514,25 @@ echo X"$ac_file" | /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } rm -f $ac_file mv $tmp/config.h $ac_file diff --git a/source3/configure.in b/source3/configure.in index 3f36cb87f12..8e15da6fac7 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -161,12 +161,12 @@ AC_ARG_ENABLE(debug, AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)], [if eval "test x$enable_developer = xyes"; then - CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wfloat-equal -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wdisabled-optimization -DDEBUG_PASSWORD -DDEVELOPER" + CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER" fi]) AC_ARG_ENABLE(krb5developer, [ --enable-krb5developer Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)], [if eval "test x$enable_krb5developer = xyes"; then - CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wfloat-equal -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wdisabled-optimization -DDEBUG_PASSWORD -DDEVELOPER" + CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER" fi]) AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc Enable heap debugging [default=no]]) -- cgit From 2b41c63b61687c2c7e1503c902d54bdf31b79bf3 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 13 Nov 2002 06:38:33 +0000 Subject: Try to bring libsmbclient in line with the new global_myname stuff (This used to be commit e424b08050b44b1b52abd2af76b1b4dc8b100095) --- source3/libsmb/libsmbclient.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index dd46749a5a9..edf582b34d9 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -46,7 +46,6 @@ static int DLIST_CONTAINS(SMBCFILE * list, SMBCFILE *p) { } extern BOOL in_client; -extern pstring global_myname; /* * Is the logging working / configfile read ? @@ -2625,8 +2624,8 @@ SMBCCTX * smbc_init_context(SMBCCTX * context) * We try to get our netbios name from the config. If that fails we fall * back on constructing our netbios name from our hostname etc */ - if (global_myname) { - context->netbios_name = strdup(global_myname); + if (global_myname()) { + context->netbios_name = strdup(global_myname()); } else { /* -- cgit From d77a6ea8a429bd9e27a646935ef98e1a4ec0b645 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 13:04:16 +0000 Subject: Move VFS documentation to SGML (This used to be commit cf9c1c2584743a059c2d266158d4e8280aaeba8a) --- docs/docbook/projdoc/VFS.sgml | 195 ++++++++++++++++++++++++++++++++++++ docs/docbook/projdoc/samba-doc.sgml | 2 + 2 files changed, 197 insertions(+) create mode 100644 docs/docbook/projdoc/VFS.sgml diff --git a/docs/docbook/projdoc/VFS.sgml b/docs/docbook/projdoc/VFS.sgml new file mode 100644 index 00000000000..4c228dfa872 --- /dev/null +++ b/docs/docbook/projdoc/VFS.sgml @@ -0,0 +1,195 @@ + + + JelmerVernooij + AlexanderBokovoy + TimPotter + SimoSorce + +Stackable VFS modules + + +Introduction and configuration + + +Since samba 3.0, samba supports stackable VFS(Virtual File System) modules. +Samba passes each request to access the unix file system thru the loaded VFS modules. +This chapter covers all the modules that come with the samba source and references to +some external modules. + + + +You may have problems to compile these modules, as shared libraries are +compiled and linked in different ways on different systems. +I currently tested them against GNU/linux and IRIX. + + + +To use the VFS modules, create a share similar to the one below. The +important parameter is the vfs object parameter which must point to +the exact pathname of the shared library object. For example, to use audit.so: + + + [audit] + comment = Audited /data directory + path = /data + vfs object = /path/to/audit.so + writeable = yes + browseable = yes + + + + +Further documentation on writing VFS modules for Samba can be found in +docs directory of the Samba source distribution. + + + + + +Included modules + + +audit +A simple module to audit file access to the syslog +facility. The following operations are logged: + +share +connect/disconnect +directory opens/create/remove +file open/close/rename/unlink/chmod + + + + + +recycle + +A recycle-bin like modules. When used any unlink call +will be intercepted and files moved to the recycle +directory instead of beeing deleted. + + +Supported options: + + + vfs_recycle_bin:repository + FIXME + + + + vfs_recycle_bin:keeptree + FIXME + + + + vfs_recycle_bin:versions + FIXME + + + + vfs_recycle_bin:touch + FIXME + + + + vfs_recycle_bin:maxsize + FIXME + + + + vfs_recycle_bin:exclude + FIXME + + + + vfs_recycle_bin:exclude_dir + FIXME + + + + vfs_recycle_bin:noversions + FIXME + + + + + + + +netatalk + +A netatalk module, that will ease co-existence of samba and +netatalk file sharing services. + + +Advantages compared to the old netatalk module: + +it doesn't care about creating of .AppleDouble forks, just keeps ones in sync +if share in smb.conf doesn't contain .AppleDouble item in hide or veto list, it will be added automatically + + + + + + + + +VFS modules available elsewhere + + +This section contains a listing of various other VFS modules that +have been posted but don't currently reside in the Samba CVS +tree for one reason ot another (e.g. it is easy for the maintainer +to have his or her own CVS tree). + + + +No statemets about the stability or functionality any module +should be implied due to its presence here. + + + +DatabaseFS + + +URL: http://www.css.tayloru.edu/~elorimer/databasefs/index.php + + +By Eric Lorimer. + + +I have created a VFS module which implements a fairly complete read-only +filesystem. It presents information from a database as a filesystem in +a modular and generic way to allow different databases to be used +(originally designed for organizing MP3s under directories such as +"Artists," "Song Keywords," etc... I have since applied it to a student +roster database very easily). The directory structure is stored in the +database itself and the module makes no assumptions about the database +structure beyond the table it requires to run. + + + +Any feedback would be appreciated: comments, suggestions, patches, +etc... If nothing else, hopefully it might prove useful for someone +else who wishes to create a virtual filesystem. + + + + + +vscan +URL: http://www.openantivirus.org/ + + +samba-vscan is a proof-of-concept module for Samba, which +uses the VFS (virtual file system) features of Samba 2.2.x/3.0 +alphaX. Of couse, Samba has to be compiled with VFS support. +samba-vscan supports various virus scanners and is maintained +by Rainer Link. + + + + + + + diff --git a/docs/docbook/projdoc/samba-doc.sgml b/docs/docbook/projdoc/samba-doc.sgml index f00dfd9db6f..52fb0e7bfa1 100644 --- a/docs/docbook/projdoc/samba-doc.sgml +++ b/docs/docbook/projdoc/samba-doc.sgml @@ -25,6 +25,7 @@ + ]> @@ -113,6 +114,7 @@ part each cover one specific feature. &WINBIND; &pdb-mysql; &pdb-xml; +&VFS; &Samba-LDAP; &CVS-Access; &GROUP-MAPPING-HOWTO; -- cgit From 0c4357e9285ac2dd60b56fffd76ec3194ce147c2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 13:08:56 +0000 Subject: Move VFS documentation to the HOWTO collection (This used to be commit b8c7ce0381e857c2de5658b25e917622ebea954e) --- examples/VFS/README | 57 +++++++--------------------------------- examples/VFS/README.OtherModules | 51 ----------------------------------- examples/VFS/README.netatalk | 18 ------------- 3 files changed, 9 insertions(+), 117 deletions(-) delete mode 100644 examples/VFS/README.OtherModules delete mode 100644 examples/VFS/README.netatalk diff --git a/examples/VFS/README b/examples/VFS/README index 1b099290591..25254c1ffc6 100644 --- a/examples/VFS/README +++ b/examples/VFS/README @@ -1,53 +1,14 @@ -README for Samba Virtual File System (VFS) Examples +README for Samba Virtual File System (VFS) Example =================================================== -This directory contains some sample code to demonstrate VFS -construction. The following VFS modules are given: +This directory contains a skeleton VFS module. When used, +this module simply passes all requests back to the disk functions +(i.e it operates as a passthrough filter). It should be +useful as a starting point for developing new VFS +modules. - skel - A skeleton VFS module. When used, this module simply - passes all requests back to the disk functions (i.e it - operates as a passthrough filter). It should be - useful as a starting point for developing new VFS - modules. - - audit - A simple module to audit file access to the syslog - facility. The following operations are logged: share - connect/disconnect, directory opens/create/remove, - file open/close/rename/unlink/chmod. - - recycle - A recycle-bin like modules. When used any unlink call - will be intercepted and files moved to the recycle - directory nstead of beeing deleted. - - block - A simple module to block access to certain mount points or - directories. This module only hides the specified directories - and all directories beneath them. It should NOT be used to - secure directories. If the name of a file in one of those - directories is known, the file can still be opened. - - netatalk - A netatalk module, that will ease co-existence of samba and - netatalk file sharing services. - Looka t the README for more informations. - -You may have problems to compile these modules, as shared libraries are -compiled and linked in different ways on different systems. -I currently tested them against GNU/linux and IRIX. - -To use the VFS modules, create a share similar to the one below. The -important parameter is the 'vfs object' parameter which must point to -the exact pathname of the shared library object. - - [audit] - comment = Audited /data directory - path = /data - vfs object = /path/to/audit.so - writeable = yes - browseable = yes +Please read the VFS chapter in the HOWTO collection for general help +on the usage of VFS modules. Further documentation on writing VFS modules for Samba can be found in -docs directory of the Samba source distribution. +Samba Developers Guide. diff --git a/examples/VFS/README.OtherModules b/examples/VFS/README.OtherModules deleted file mode 100644 index 5693d2e3f43..00000000000 --- a/examples/VFS/README.OtherModules +++ /dev/null @@ -1,51 +0,0 @@ -This file contains a listing of various other VFS modules that -have been posted but don't currently reside in the Samba CVS -tree for one reason ot another (e.g. it is easy for the maintainer -to have his or her own CVS tree). - -No statemets about the stability or functionality any module -should be implied due to its presence here. - - ------------------------------------------------------------- -URL: http://www.css.tayloru.edu/~elorimer/databasefs/index.php - -Date: Sat, 28 Sep 2002 23:41:31 -0500 -From: Eric Lorimer -To: samba-technical@lists.samba.org -Subject: DatabaseFS VFS module - -Hello, - -I have created a VFS module which implements a fairly complete read-only -filesystem. It presents information from a database as a filesystem in -a modular and generic way to allow different databases to be used -(originally designed for organizing MP3s under directories such as -"Artists," "Song Keywords," etc... I have since applied it to a student -roster database very easily). The directory structure is stored in the -database itself and the module makes no assumptions about the database -structure beyond the table it requires to run. You can find it at: - -http://www.css.tayloru.edu/~elorimer/databasefs/index.php - - -Any feedback would be appreciated: comments, suggestions, patches, -etc... If nothing else, hopefully it might prove useful for someone -else who wishes to create a virtual filesystem. - -Thanks for the great product and keep up the good work. - - -- Eric Lorimer - ------------------------------------------------------------- -URL: http://www.openantivirus.org/ - -"samba-vscan is a proof-of-concept module for Samba, which -uses the VFS (virtual file system) features of Samba 2.2.x/3.0 -alphaX. Of couse, Samba has to be compiled with VFS support. -samba-vscan supports various virus scanners and is maintained -by Rainer Link". - ------------------------------------------------------------- - diff --git a/examples/VFS/README.netatalk b/examples/VFS/README.netatalk deleted file mode 100644 index 70f6eea316d..00000000000 --- a/examples/VFS/README.netatalk +++ /dev/null @@ -1,18 +0,0 @@ -There is the new netatalk module both for HEAD. -This one has some difference from previous module: - --- it doesn't care about creating of .AppleDouble forks, just keeps ones in -sync; - --- if share in smb.conf doesn't contain .AppleDouble item in hide or veto -list, it will be added automatically. - -To my way of thinking, module became more lightweight and speedy. - -How to compile: - -you should place proper netatalk.c into examples/VFS/ then run 'configure' -from source/ and then run 'make' from examples/VFS/. - -add string 'vfs object = /netatlk.so' to smb.conf. It may -be defined either as global or as share-specific parameter. -- cgit From 861bbd3c2809ddf201170efc275f1e632beeedd1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 13:11:04 +0000 Subject: Move working VFS modules to source/modules/ (This used to be commit 14b129e301c94ccf47b9105bda1bd9d142feb1b5) --- examples/VFS/audit.c | 268 -------------------- examples/VFS/netatalk.c | 430 ------------------------------- examples/VFS/recycle.c | 559 ----------------------------------------- source3/modules/vfs_audit.c | 268 ++++++++++++++++++++ source3/modules/vfs_netatalk.c | 430 +++++++++++++++++++++++++++++++ source3/modules/vfs_recycle.c | 559 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 1257 insertions(+), 1257 deletions(-) delete mode 100644 examples/VFS/audit.c delete mode 100644 examples/VFS/netatalk.c delete mode 100644 examples/VFS/recycle.c create mode 100644 source3/modules/vfs_audit.c create mode 100644 source3/modules/vfs_netatalk.c create mode 100644 source3/modules/vfs_recycle.c diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c deleted file mode 100644 index 92b78c1c32f..00000000000 --- a/examples/VFS/audit.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Auditing VFS module for samba. Log selected file operations to syslog - * facility. - * - * Copyright (C) Tim Potter, 1999-2000 - * Copyright (C) Alexander Bokovoy, 2002 - * - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * 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. - */ - -#include "config.h" -#include -#include -#ifdef HAVE_UTIME_H -#include -#endif -#ifdef HAVE_DIRENT_H -#include -#endif -#include -#ifdef HAVE_FCNTL_H -#include -#endif -#include -#include -#include -#include - -#ifndef SYSLOG_FACILITY -#define SYSLOG_FACILITY LOG_USER -#endif - -#ifndef SYSLOG_PRIORITY -#define SYSLOG_PRIORITY LOG_NOTICE -#endif - -/* Function prototypes */ - -static int audit_connect(struct connection_struct *conn, const char *svc, const char *user); -static void audit_disconnect(struct connection_struct *conn); -static DIR *audit_opendir(struct connection_struct *conn, const char *fname); -static int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode); -static int audit_rmdir(struct connection_struct *conn, const char *path); -static int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode); -static int audit_close(struct files_struct *fsp, int fd); -static int audit_rename(struct connection_struct *conn, const char *old, const char *new); -static int audit_unlink(struct connection_struct *conn, const char *path); -static int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode); -static int audit_chmod_acl(struct connection_struct *conn, const char *name, mode_t mode); -static int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode); -static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode); - -/* VFS operations */ - -static struct vfs_ops default_vfs_ops; /* For passthrough operation */ -static struct smb_vfs_handle_struct *audit_handle; - -static vfs_op_tuple audit_ops[] = { - - /* Disk operations */ - - {audit_connect, SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_LOGGER}, - {audit_disconnect, SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_LOGGER}, - - /* Directory operations */ - - {audit_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_LOGGER}, - {audit_mkdir, SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_LOGGER}, - {audit_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_LOGGER}, - - /* File operations */ - - {audit_open, SMB_VFS_OP_OPEN, SMB_VFS_LAYER_LOGGER}, - {audit_close, SMB_VFS_OP_CLOSE, SMB_VFS_LAYER_LOGGER}, - {audit_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_LOGGER}, - {audit_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_LOGGER}, - {audit_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_LOGGER}, - {audit_fchmod, SMB_VFS_OP_FCHMOD, SMB_VFS_LAYER_LOGGER}, - {audit_chmod_acl, SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_LOGGER}, - {audit_fchmod_acl, SMB_VFS_OP_FCHMOD_ACL, SMB_VFS_LAYER_LOGGER}, - - /* Finish VFS operations definition */ - - {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} -}; - -/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ - -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, - struct smb_vfs_handle_struct *vfs_handle) -{ - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - - audit_handle = vfs_handle; - - openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); - syslog(SYSLOG_PRIORITY, "VFS_INIT: vfs_ops loaded\n"); - return audit_ops; -} - -/* VFS finalization function. */ -void vfs_done(connection_struct *conn) -{ - syslog(SYSLOG_PRIORITY, "VFS_DONE: vfs module unloaded\n"); -} - -/* Implementation of vfs_ops. Pass everything on to the default - operation but log event first. */ - -static int audit_connect(struct connection_struct *conn, const char *svc, const char *user) -{ - syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", - svc, user); - - return default_vfs_ops.connect(conn, svc, user); -} - -static void audit_disconnect(struct connection_struct *conn) -{ - syslog(SYSLOG_PRIORITY, "disconnected\n"); - default_vfs_ops.disconnect(conn); -} - -static DIR *audit_opendir(struct connection_struct *conn, const char *fname) -{ - DIR *result = default_vfs_ops.opendir(conn, fname); - - syslog(SYSLOG_PRIORITY, "opendir %s %s%s\n", - fname, - (result == NULL) ? "failed: " : "", - (result == NULL) ? strerror(errno) : ""); - - return result; -} - -static int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode) -{ - int result = default_vfs_ops.mkdir(conn, path, mode); - - syslog(SYSLOG_PRIORITY, "mkdir %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_rmdir(struct connection_struct *conn, const char *path) -{ - int result = default_vfs_ops.rmdir(conn, path); - - syslog(SYSLOG_PRIORITY, "rmdir %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode) -{ - int result = default_vfs_ops.open(conn, fname, flags, mode); - - syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n", - fname, result, - ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_close(struct files_struct *fsp, int fd) -{ - int result = default_vfs_ops.close(fsp, fd); - - syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n", - fd, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_rename(struct connection_struct *conn, const char *old, const char *new) -{ - int result = default_vfs_ops.rename(conn, old, new); - - syslog(SYSLOG_PRIORITY, "rename %s -> %s %s%s\n", - old, new, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_unlink(struct connection_struct *conn, const char *path) -{ - int result = default_vfs_ops.unlink(conn, path); - - syslog(SYSLOG_PRIORITY, "unlink %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode) -{ - int result = default_vfs_ops.chmod(conn, path, mode); - - syslog(SYSLOG_PRIORITY, "chmod %s mode 0x%x %s%s\n", - path, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_chmod_acl(struct connection_struct *conn, const char *path, mode_t mode) -{ - int result = default_vfs_ops.chmod_acl(conn, path, mode); - - syslog(SYSLOG_PRIORITY, "chmod_acl %s mode 0x%x %s%s\n", - path, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode) -{ - int result = default_vfs_ops.fchmod(fsp, fd, mode); - - syslog(SYSLOG_PRIORITY, "fchmod %s mode 0x%x %s%s\n", - fsp->fsp_name, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) -{ - int result = default_vfs_ops.fchmod_acl(fsp, fd, mode); - - syslog(SYSLOG_PRIORITY, "fchmod_acl %s mode 0x%x %s%s\n", - fsp->fsp_name, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} diff --git a/examples/VFS/netatalk.c b/examples/VFS/netatalk.c deleted file mode 100644 index 353be36e6f0..00000000000 --- a/examples/VFS/netatalk.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * AppleTalk VFS module for Samba-3.x - * - * Copyright (C) Alexei Kotovich, 2002 - * - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * 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. - */ - -#include "config.h" -#include -#include -#ifdef HAVE_UTIME_H -#include -#endif -#ifdef HAVE_DIRENT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#include -#include -#include -#include - -#define APPLEDOUBLE ".AppleDouble" -#define ADOUBLEMODE 0777 - -/* atalk functions */ - -static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, - const char *fname, char **adbl_path, char **orig_path, - SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info); - -static int atalk_unlink_file(const char *path); - -static struct vfs_ops default_vfs_ops; /* For passthrough operation */ -static struct smb_vfs_handle_struct *atalk_handle; - -static int atalk_get_path_ptr(char *path) -{ - int i = 0; - int ptr = 0; - - for (i = 0; path[i]; i ++) { - if (path[i] == '/') - ptr = i; - /* get out some 'spam';) from win32's file name */ - else if (path[i] == ':') { - path[i] = '\0'; - break; - } - } - - return ptr; -} - -static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, const char *fname, - char **adbl_path, char **orig_path, - SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info) -{ - int ptr0 = 0; - int ptr1 = 0; - char *dname = 0; - char *name = 0; - - if (!ctx || !path || !fname || !adbl_path || !orig_path || - !adbl_info || !orig_info) - return -1; -#if 0 - DEBUG(3, ("ATALK: PATH: %s[%s]\n", path, fname)); -#endif - if (strstr(path, APPLEDOUBLE) || strstr(fname, APPLEDOUBLE)) { - DEBUG(3, ("ATALK: path %s[%s] already contains %s\n", path, fname, APPLEDOUBLE)); - return -1; - } - - if (fname[0] == '.') ptr0 ++; - if (fname[1] == '/') ptr0 ++; - - *orig_path = talloc_asprintf(ctx, "%s/%s", path, &fname[ptr0]); - - /* get pointer to last '/' */ - ptr1 = atalk_get_path_ptr(*orig_path); - - sys_lstat(*orig_path, orig_info); - - if (S_ISDIR(orig_info->st_mode)) { - *adbl_path = talloc_asprintf(ctx, "%s/%s/%s/", - path, &fname[ptr0], APPLEDOUBLE); - } else { - dname = talloc_strdup(ctx, *orig_path); - dname[ptr1] = '\0'; - name = *orig_path; - *adbl_path = talloc_asprintf(ctx, "%s/%s/%s", - dname, APPLEDOUBLE, &name[ptr1 + 1]); - } -#if 0 - DEBUG(3, ("ATALK: DEBUG:\n%s\n%s\n", *orig_path, *adbl_path)); -#endif - sys_lstat(*adbl_path, adbl_info); - return 0; -} - -static int atalk_unlink_file(const char *path) -{ - int ret = 0; - - become_root(); - ret = unlink(path); - unbecome_root(); - - return ret; -} - -static void atalk_add_to_list(name_compare_entry **list) -{ - int i, count = 0; - name_compare_entry *new_list = 0; - name_compare_entry *cur_list = 0; - - cur_list = *list; - - if (cur_list) { - for (i = 0, count = 0; cur_list[i].name; i ++, count ++) { - if (strstr(cur_list[i].name, APPLEDOUBLE)) - return; - } - } - - if (!(new_list = calloc(1, - (count == 0 ? 1 : count + 1) * sizeof(name_compare_entry)))) - return; - - for (i = 0; i < count; i ++) { - new_list[i].name = strdup(cur_list[i].name); - new_list[i].is_wild = cur_list[i].is_wild; - } - - new_list[i].name = strdup(APPLEDOUBLE); - new_list[i].is_wild = False; - - free_namearray(*list); - - *list = new_list; - new_list = 0; - cur_list = 0; -} - -static void atalk_rrmdir(TALLOC_CTX *ctx, char *path) -{ - int n; - char *dpath; - struct dirent **namelist; - - if (!path) return; - - n = scandir(path, &namelist, 0, alphasort); - if (n < 0) { - return; - } else { - while (n --) { - if (strcmp(namelist[n]->d_name, ".") == 0 || - strcmp(namelist[n]->d_name, "..") == 0) - continue; - if (!(dpath = talloc_asprintf(ctx, "%s/%s", - path, namelist[n]->d_name))) - continue; - atalk_unlink_file(dpath); - free(namelist[n]); - } - } -} - -/* Disk operations */ - -/* Directory operations */ - -DIR *atalk_opendir(struct connection_struct *conn, const char *fname) -{ - DIR *ret = 0; - - ret = default_vfs_ops.opendir(conn, fname); - - /* - * when we try to perform delete operation upon file which has fork - * in ./.AppleDouble and this directory wasn't hidden by Samba, - * MS Windows explorer causes the error: "Cannot find the specified file" - * There is some workaround to avoid this situation, i.e. if - * connection has not .AppleDouble entry in either veto or hide - * list then it would be nice to add one. - */ - - atalk_add_to_list(&conn->hide_list); - atalk_add_to_list(&conn->veto_list); - - return ret; -} - -static int atalk_rmdir(struct connection_struct *conn, const char *path) -{ - BOOL add = False; - TALLOC_CTX *ctx = 0; - char *dpath; - - if (!conn || !conn->origpath || !path) goto exit_rmdir; - - /* due to there is no way to change bDeleteVetoFiles variable - * from this module, gotta use talloc stuff.. - */ - - strstr(path, APPLEDOUBLE) ? (add = False) : (add = True); - - if (!(ctx = talloc_init_named("remove_directory"))) - goto exit_rmdir; - - if (!(dpath = talloc_asprintf(ctx, "%s/%s%s", - conn->origpath, path, add ? "/"APPLEDOUBLE : ""))) - goto exit_rmdir; - - atalk_rrmdir(ctx, dpath); - -exit_rmdir: - talloc_destroy(ctx); - return default_vfs_ops.rmdir(conn, path); -} - -/* File operations */ - -static int atalk_rename(struct connection_struct *conn, const char *old, const char *new) -{ - int ret = 0; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.rename(conn, old, new); - - if (!conn || !old) return ret; - - if (!(ctx = talloc_init_named("rename_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, old, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); - goto exit_rename; - } - - atalk_unlink_file(adbl_path); - -exit_rename: - talloc_destroy(ctx); - return ret; -} - -static int atalk_unlink(struct connection_struct *conn, const char *path) -{ - int ret = 0, i; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.unlink(conn, path); - - if (!conn || !path) return ret; - - /* no .AppleDouble sync if veto or hide list is empty, - * otherwise "Cannot find the specified file" error will be caused - */ - - if (!conn->veto_list) return ret; - if (!conn->hide_list) return ret; - - for (i = 0; conn->veto_list[i].name; i ++) { - if (strstr(conn->veto_list[i].name, APPLEDOUBLE)) - break; - } - - if (!conn->veto_list[i].name) { - for (i = 0; conn->hide_list[i].name; i ++) { - if (strstr(conn->hide_list[i].name, APPLEDOUBLE)) - break; - else { - DEBUG(3, ("ATALK: %s is not hidden, skipped..\n", - APPLEDOUBLE)); - return ret; - } - } - } - - if (!(ctx = talloc_init_named("unlink_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); - goto exit_unlink; - } - - atalk_unlink_file(adbl_path); - -exit_unlink: - talloc_destroy(ctx); - return ret; -} - -static int atalk_chmod(struct connection_struct *conn, const char *path, mode_t mode) -{ - int ret = 0; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.chmod(conn, path, mode); - - if (!conn || !path) return ret; - - if (!(ctx = talloc_init_named("chmod_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); - goto exit_chmod; - } - - chmod(adbl_path, ADOUBLEMODE); - -exit_chmod: - talloc_destroy(ctx); - return ret; -} - -static int atalk_chown(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid) -{ - int ret = 0; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.chown(conn, path, uid, gid); - - if (!conn || !path) return ret; - - if (!(ctx = talloc_init_named("chown_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); - goto exit_chown; - } - - chown(adbl_path, uid, gid); - -exit_chown: - talloc_destroy(ctx); - return ret; -} - -static vfs_op_tuple atalk_ops[] = { - - /* Directory operations */ - - {atalk_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, - - /* File operations */ - - {atalk_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_chown, SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, - - /* Finish VFS operations definition */ - - {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} -}; - -/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, - struct smb_vfs_handle_struct *vfs_handle) -{ - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - - atalk_handle = vfs_handle; - - DEBUG(3, ("ATALK: vfs module loaded\n")); - return atalk_ops; -} - -/* VFS finalization function. */ -void vfs_done(connection_struct *conn) -{ - DEBUG(3, ("ATALK: vfs module unloaded\n")); -} diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c deleted file mode 100644 index b59cb92a28f..00000000000 --- a/examples/VFS/recycle.c +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Recycle bin VFS module for Samba. - * - * Copyright (C) 2001, Brandon Stone, Amherst College, . - * Copyright (C) 2002, Jeremy Allison - modified to make a VFS module. - * Copyright (C) 2002, Alexander Bokovoy - cascaded VFS adoption, - * Copyright (C) 2002, Juergen Hasch - added some options. - * Copyright (C) 2002, Simo Sorce - * - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * 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. - */ - -#include "includes.h" - -#define ALLOC_CHECK(ptr, label) do { if ((ptr) == NULL) { DEBUG(0, ("recycle.bin: out of memory!\n")); errno = ENOMEM; goto label; } } while(0) - -static int vfs_recycle_debug_level = DBGC_VFS; - -#undef DBGC_CLASS -#define DBGC_CLASS vfs_recycle_debug_level - -static const char *delimiter = "|"; /* delimiter for options */ - -/* One per connection */ - -typedef struct recycle_bin_struct -{ - TALLOC_CTX *ctx; - char *repository; /* name of the recycle bin directory */ - BOOL keep_dir_tree; /* keep directory structure of deleted file in recycle bin */ - BOOL versions; /* create versions of deleted files with identical name */ - BOOL touch; /* touch access date of deleted file */ - char *exclude; /* which files to exclude */ - char *exclude_dir; /* which directories to exclude */ - char *noversions; /* which files to exclude from versioning */ - SMB_OFF_T maxsize; /* maximum file size to be saved */ -} recycle_bin_struct; - -/* VFS operations */ -static struct vfs_ops default_vfs_ops; /* For passthrough operation */ - -static int recycle_connect(struct connection_struct *conn, const char *service, const char *user); -static void recycle_disconnect(struct connection_struct *conn); -static int recycle_unlink(connection_struct *, const char *); - -#define VFS_OP(x) ((void *) x) - -static vfs_op_tuple recycle_ops[] = { - - /* Disk operations */ - {VFS_OP(recycle_connect), SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, - {VFS_OP(recycle_disconnect), SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_TRANSPARENT}, - - /* File operations */ - {VFS_OP(recycle_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, - - {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} -}; - -static BOOL check_bool_param(const char *value) -{ - if (strwicmp(value, "yes") == 0 || - strwicmp(value, "true") == 0 || - strwicmp(value, "1") == 0) - return True; - - return False; -} - -/** - * VFS initialisation function. - * - * @retval initialised vfs_op_tuple array - **/ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, - struct smb_vfs_handle_struct *vfs_handle) -{ - DEBUG(10, ("Initializing VFS module recycle\n")); - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - vfs_recycle_debug_level = debug_add_class("vfs_recycle_bin"); - if (vfs_recycle_debug_level == -1) { - vfs_recycle_debug_level = DBGC_VFS; - DEBUG(0, ("vfs_recycle: Couldn't register custom debugging class!\n")); - } else { - DEBUG(0, ("vfs_recycle: Debug class number of 'vfs_recycle': %d\n", vfs_recycle_debug_level)); - } - - return recycle_ops; -} - -/** - * VFS finalization function. - * - **/ -void vfs_done(connection_struct *conn) -{ - DEBUG(10,("Called for connection %d\n", SNUM(conn))); -} - -static int recycle_connect(struct connection_struct *conn, const char *service, const char *user) -{ - TALLOC_CTX *ctx = NULL; - recycle_bin_struct *recbin; - char *servicename; - char *tmp_str; - - DEBUG(10, ("Called for service %s (%d) as user %s\n", service, SNUM(conn), user)); - - if (!(ctx = talloc_init_named("recycle bin"))) { - DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n")); - return 0; - } - - recbin = talloc(ctx,sizeof(recycle_bin_struct)); - if ( recbin == NULL) { - DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n")); - return -1; - } - recbin->ctx = ctx; - - /* Set defaults */ - recbin->repository = talloc_strdup(ctx, ".recycle"); - ALLOC_CHECK(recbin->repository, error); - recbin->keep_dir_tree = False; - recbin->versions = False; - recbin->touch = False; - recbin->exclude = ""; - recbin->exclude_dir = ""; - recbin->noversions = ""; - recbin->maxsize = 0; - - /* parse configuration options */ - servicename = talloc_strdup(recbin->ctx, lp_servicename(SNUM(conn))); - DEBUG(10, ("servicename = %s\n",servicename)); - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "repository")) != NULL) { - recbin->repository = talloc_sub_conn(ctx, conn, tmp_str); - ALLOC_CHECK(recbin->repository, error); - trim_string(recbin->repository, "/", "/"); - DEBUG(5, ("recycle.bin: repository = %s\n", recbin->repository)); - } - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "keeptree")) != NULL) { - if (check_bool_param(tmp_str) == True) - recbin->keep_dir_tree = True; - DEBUG(5, ("recycle.bin: keeptree = %s\n", tmp_str)); - } - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "versions")) != NULL) { - if (check_bool_param(tmp_str) == True) - recbin->versions = True; - DEBUG(5, ("recycle.bin: versions = %s\n", tmp_str)); - } - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "touch")) != NULL) { - if (check_bool_param(tmp_str) == True) - recbin->touch = True; - DEBUG(5, ("recycle.bin: touch = %s\n", tmp_str)); - } - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "maxsize")) != NULL) { - recbin->maxsize = strtoul(tmp_str, NULL, 10); - if (recbin->maxsize == 0) { - recbin->maxsize = -1; - DEBUG(5, ("recycle.bin: maxsize = -infinite-\n")); - } else { - DEBUG(5, ("recycle.bin: maxsize = %ld\n", (long int)recbin->maxsize)); - } - } - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "exclude")) != NULL) { - recbin->exclude = talloc_strdup(ctx, tmp_str); - ALLOC_CHECK(recbin->exclude, error); - DEBUG(5, ("recycle.bin: exclude = %s\n", recbin->exclude)); - } - if ((tmp_str = lp_parm_string(servicename,"vfs_recycle_bin", "exclude_dir")) != NULL) { - recbin->exclude_dir = talloc_strdup(ctx, tmp_str); - ALLOC_CHECK(recbin->exclude_dir, error); - DEBUG(5, ("recycle.bin: exclude_dir = %s\n", recbin->exclude_dir)); - } - if ((tmp_str = lp_parm_string(servicename,"vfs_recycle_bin", "noversions")) != NULL) { - recbin->noversions = talloc_strdup(ctx, tmp_str); - ALLOC_CHECK(recbin->noversions, error); - DEBUG(5, ("recycle.bin: noversions = %s\n", recbin->noversions)); - } - - conn->vfs_private = (void *)recbin; - return default_vfs_ops.connect(conn, service, user); - -error: - talloc_destroy(ctx); - return -1; -} - -static void recycle_disconnect(struct connection_struct *conn) -{ - DEBUG(10, ("Disconnecting VFS module recycle bin\n")); - if (conn->vfs_private) { - talloc_destroy(((recycle_bin_struct *)conn->vfs_private)->ctx); - conn->vfs_private = NULL; - } - default_vfs_ops.disconnect(conn); -} - -static BOOL recycle_directory_exist(connection_struct *conn, const char *dname) -{ - SMB_STRUCT_STAT st; - - if (default_vfs_ops.stat(conn, dname, &st) == 0) { - if (S_ISDIR(st.st_mode)) { - return True; - } - } - - return False; -} - -static BOOL recycle_file_exist(connection_struct *conn, const char *fname) -{ - SMB_STRUCT_STAT st; - - if (default_vfs_ops.stat(conn, fname, &st) == 0) { - if (S_ISREG(st.st_mode)) { - return True; - } - } - - return False; -} - -/** - * Return file size - * @param conn connection - * @param fname file name - * @return size in bytes - **/ -static SMB_OFF_T recycle_get_file_size(connection_struct *conn, const char *fname) -{ - SMB_STRUCT_STAT st; - if (default_vfs_ops.stat(conn, fname, &st) != 0) { - DEBUG(0,("recycle.bin: stat for %s returned %s\n", fname, strerror(errno))); - return (SMB_OFF_T)0; - } - return(st.st_size); -} - -/** - * Create directory tree - * @param conn connection - * @param dname Directory tree to be created - * @return Returns True for success - **/ -static BOOL recycle_create_dir(connection_struct *conn, const char *dname) -{ - int len; - mode_t mode; - char *new_dir = NULL; - char *tmp_str = NULL; - char *token; - char *tok_str; - BOOL ret = False; - - mode = S_IREAD | S_IWRITE | S_IEXEC; - - tmp_str = strdup(dname); - ALLOC_CHECK(tmp_str, done); - tok_str = tmp_str; - - len = strlen(dname); - new_dir = (char *)malloc(len + 1); - ALLOC_CHECK(new_dir, done); - *new_dir = '\0'; - - /* Create directory tree if neccessary */ - for(token = strtok(tok_str, "/"); token; token = strtok(NULL, "/")) { - safe_strcat(new_dir, token, len); - if (recycle_directory_exist(conn, new_dir)) - DEBUG(10, ("recycle.bin: dir %s already exists\n", new_dir)); - else { - DEBUG(5, ("recycle.bin: creating new dir %s\n", new_dir)); - if (default_vfs_ops.mkdir(conn, new_dir, mode) != 0) { - DEBUG(1,("recycle.bin: mkdir failed for %s with error: %s\n", new_dir, strerror(errno))); - ret = False; - goto done; - } - } - safe_strcat(new_dir, "/", len); - } - - ret = True; -done: - SAFE_FREE(tmp_str); - SAFE_FREE(new_dir); - return ret; -} - -/** - * Check if needle is contained exactly in haystack - * @param haystack list of parameters separated by delimimiter character - * @param needle string to be matched exactly to haystack - * @return True if found - **/ -static BOOL checkparam(const char *haystack, const char *needle) -{ - char *token; - char *tok_str; - char *tmp_str; - BOOL ret = False; - - if (haystack == NULL || strlen(haystack) == 0 || needle == NULL || strlen(needle) == 0) { - return False; - } - - tmp_str = strdup(haystack); - ALLOC_CHECK(tmp_str, done); - token = tok_str = tmp_str; - - for(token = strtok(tok_str, delimiter); token; token = strtok(NULL, delimiter)) { - if(strcmp(token, needle) == 0) { - ret = True; - goto done; - } - } -done: - SAFE_FREE(tmp_str); - return ret; -} - -/** - * Check if needle is contained in haystack, * and ? patterns are resolved - * @param haystack list of parameters separated by delimimiter character - * @param needle string to be matched exectly to haystack including pattern matching - * @return True if found - **/ -static BOOL matchparam(const char *haystack, const char *needle) -{ - char *token; - char *tok_str; - char *tmp_str; - BOOL ret = False; - - if (haystack == NULL || strlen(haystack) == 0 || needle == NULL || strlen(needle) == 0) { - return False; - } - - tmp_str = strdup(haystack); - ALLOC_CHECK(tmp_str, done); - token = tok_str = tmp_str; - - for(token = strtok(tok_str, delimiter); token; token = strtok(NULL, delimiter)) { - if (!unix_wild_match(token, needle)) { - ret = True; - goto done; - } - } -done: - SAFE_FREE(tmp_str); - return ret; -} - -/** - * Touch access date - **/ -static void recycle_touch(connection_struct *conn, const char *fname) -{ - SMB_STRUCT_STAT st; - struct utimbuf tb; - time_t currtime; - - if (default_vfs_ops.stat(conn, fname, &st) != 0) { - DEBUG(0,("recycle.bin: stat for %s returned %s\n", fname, strerror(errno))); - return; - } - currtime = time(&currtime); - tb.actime = currtime; - tb.modtime = st.st_mtime; - - if (default_vfs_ops.utime(conn, fname, &tb) == -1 ) - DEBUG(0, ("recycle.bin: touching %s failed, reason = %s\n", fname, strerror(errno))); - } - -/** - * Check if file should be recycled - **/ -static int recycle_unlink(connection_struct *conn, const char *inname) -{ - recycle_bin_struct *recbin; - char *file_name = NULL; - char *path_name = NULL; - char *temp_name = NULL; - char *final_name = NULL; - char *base; - int i; - SMB_BIG_UINT dfree, dsize, bsize; - SMB_OFF_T file_size, space_avail; - BOOL exist; - int rc = -1; - - file_name = strdup(inname); - ALLOC_CHECK(file_name, done); - - if (conn->vfs_private) - recbin = (recycle_bin_struct *)conn->vfs_private; - else { - DEBUG(0, ("Recycle bin not initialized!\n")); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - if(!recbin->repository || *(recbin->repository) == '\0') { - DEBUG(3, ("Recycle path not set, purging %s...\n", file_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - /* we don't recycle the recycle bin... */ - if (strncmp(file_name, recbin->repository, strlen(recbin->repository)) == 0) { - DEBUG(3, ("File is within recycling bin, unlinking ...\n")); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - file_size = recycle_get_file_size(conn, file_name); - /* it is wrong to purge filenames only because they are empty imho - * --- simo - * - if(fsize == 0) { - DEBUG(3, ("File %s is empty, purging...\n", file_name)); - rc = default_vfs_ops.unlink(conn,file_name); - goto done; - } - */ - - /* FIXME: this is wrong, we should check the hole size of the recycle bin is - * not greater then maxsize, not the size of the single file, also it is better - * to remove older files - */ - if(recbin->maxsize > 0 && file_size > recbin->maxsize) { - DEBUG(3, ("File %s exceeds maximum recycle size, purging... \n", file_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - /* FIXME: this is wrong: moving files with rename does not change the disk space - * allocation - * - space_avail = default_vfs_ops.disk_free(conn, ".", True, &bsize, &dfree, &dsize) * 1024L; - DEBUG(5, ("space_avail = %Lu, file_size = %Lu\n", space_avail, file_size)); - if(space_avail < file_size) { - DEBUG(3, ("Not enough diskspace, purging file %s\n", file_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - */ - - /* extract filename and path */ - path_name = (char *)malloc(PATH_MAX); - ALLOC_CHECK(path_name, done); - *path_name = '\0'; - safe_strcpy(path_name, file_name, PATH_MAX); - base = strrchr(path_name, '/'); - if (base == NULL) { - base = file_name; - safe_strcpy(path_name, "/", PATH_MAX); - } - else { - *base = '\0'; - base++; - } - - DEBUG(10, ("recycle.bin: fname = %s\n", file_name)); /* original filename with path */ - DEBUG(10, ("recycle.bin: fpath = %s\n", path_name)); /* original path */ - DEBUG(10, ("recycle.bin: base = %s\n", base)); /* filename without path */ - - if (matchparam(recbin->exclude, base)) { - DEBUG(3, ("recycle.bin: file %s is excluded \n", base)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - /* FIXME: this check will fail if we have more than one level of directories, - * we shoud check for every level 1, 1/2, 1/2/3, 1/2/3/4 .... - * ---simo - */ - if (checkparam(recbin->exclude_dir, path_name)) { - DEBUG(3, ("recycle.bin: directory %s is excluded \n", path_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - temp_name = (char *)malloc(PATH_MAX); - ALLOC_CHECK(temp_name, done); - safe_strcpy(temp_name, recbin->repository, PATH_MAX); - - /* see if we need to recreate the original directory structure in the recycle bin */ - if (recbin->keep_dir_tree == True) { - safe_strcat(temp_name, "/", PATH_MAX); - safe_strcat(temp_name, path_name, PATH_MAX); - } - - exist = recycle_directory_exist(conn, temp_name); - if (exist) { - DEBUG(10, ("recycle.bin: Directory already exists\n")); - } else { - DEBUG(10, ("recycle.bin: Creating directory %s\n", temp_name)); - if (recycle_create_dir(conn, temp_name) == False) { - DEBUG(3, ("Could not create directory, purging %s...\n", file_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - } - - final_name = (char *)malloc(PATH_MAX); - ALLOC_CHECK(final_name, done); - snprintf(final_name, PATH_MAX, "%s/%s", temp_name, base); - DEBUG(10, ("recycle.bin: recycled file name%s\n", temp_name)); /* new filename with path */ - - /* check if we should delete file from recycle bin */ - if (recycle_file_exist(conn, final_name)) { - if (recbin->versions == False || matchparam(recbin->noversions, base) == True) { - DEBUG(3, ("recycle.bin: Removing old file %s from recycle bin\n", final_name)); - if (default_vfs_ops.unlink(conn, final_name) != 0) { - DEBUG(1, ("recycle.bin: Error deleting old file: %s\n", strerror(errno))); - } - } - } - - /* rename file we move to recycle bin */ - i = 1; - while (recycle_file_exist(conn, final_name)) { - snprintf(final_name, PATH_MAX, "%s/Copy #%d of %s", temp_name, i++, base); - } - - DEBUG(10, ("recycle.bin: Moving %s to %s\n", file_name, final_name)); - rc = default_vfs_ops.rename(conn, file_name, final_name); - if (rc != 0) { - DEBUG(3, ("recycle.bin: Move error %d (%s), purging file %s (%s)\n", errno, strerror(errno), file_name, final_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - /* touch access date of moved file */ - if (recbin->touch == True ) - recycle_touch(conn, final_name); - -done: - SAFE_FREE(file_name); - SAFE_FREE(path_name); - SAFE_FREE(temp_name); - SAFE_FREE(final_name); - return rc; -} diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c new file mode 100644 index 00000000000..92b78c1c32f --- /dev/null +++ b/source3/modules/vfs_audit.c @@ -0,0 +1,268 @@ +/* + * Auditing VFS module for samba. Log selected file operations to syslog + * facility. + * + * Copyright (C) Tim Potter, 1999-2000 + * Copyright (C) Alexander Bokovoy, 2002 + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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. + */ + +#include "config.h" +#include +#include +#ifdef HAVE_UTIME_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#include +#ifdef HAVE_FCNTL_H +#include +#endif +#include +#include +#include +#include + +#ifndef SYSLOG_FACILITY +#define SYSLOG_FACILITY LOG_USER +#endif + +#ifndef SYSLOG_PRIORITY +#define SYSLOG_PRIORITY LOG_NOTICE +#endif + +/* Function prototypes */ + +static int audit_connect(struct connection_struct *conn, const char *svc, const char *user); +static void audit_disconnect(struct connection_struct *conn); +static DIR *audit_opendir(struct connection_struct *conn, const char *fname); +static int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode); +static int audit_rmdir(struct connection_struct *conn, const char *path); +static int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode); +static int audit_close(struct files_struct *fsp, int fd); +static int audit_rename(struct connection_struct *conn, const char *old, const char *new); +static int audit_unlink(struct connection_struct *conn, const char *path); +static int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode); +static int audit_chmod_acl(struct connection_struct *conn, const char *name, mode_t mode); +static int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode); +static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode); + +/* VFS operations */ + +static struct vfs_ops default_vfs_ops; /* For passthrough operation */ +static struct smb_vfs_handle_struct *audit_handle; + +static vfs_op_tuple audit_ops[] = { + + /* Disk operations */ + + {audit_connect, SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_LOGGER}, + {audit_disconnect, SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_LOGGER}, + + /* Directory operations */ + + {audit_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_LOGGER}, + {audit_mkdir, SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_LOGGER}, + {audit_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_LOGGER}, + + /* File operations */ + + {audit_open, SMB_VFS_OP_OPEN, SMB_VFS_LAYER_LOGGER}, + {audit_close, SMB_VFS_OP_CLOSE, SMB_VFS_LAYER_LOGGER}, + {audit_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_LOGGER}, + {audit_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_LOGGER}, + {audit_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_LOGGER}, + {audit_fchmod, SMB_VFS_OP_FCHMOD, SMB_VFS_LAYER_LOGGER}, + {audit_chmod_acl, SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_LOGGER}, + {audit_fchmod_acl, SMB_VFS_OP_FCHMOD_ACL, SMB_VFS_LAYER_LOGGER}, + + /* Finish VFS operations definition */ + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ + +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle) +{ + *vfs_version = SMB_VFS_INTERFACE_VERSION; + memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + audit_handle = vfs_handle; + + openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); + syslog(SYSLOG_PRIORITY, "VFS_INIT: vfs_ops loaded\n"); + return audit_ops; +} + +/* VFS finalization function. */ +void vfs_done(connection_struct *conn) +{ + syslog(SYSLOG_PRIORITY, "VFS_DONE: vfs module unloaded\n"); +} + +/* Implementation of vfs_ops. Pass everything on to the default + operation but log event first. */ + +static int audit_connect(struct connection_struct *conn, const char *svc, const char *user) +{ + syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", + svc, user); + + return default_vfs_ops.connect(conn, svc, user); +} + +static void audit_disconnect(struct connection_struct *conn) +{ + syslog(SYSLOG_PRIORITY, "disconnected\n"); + default_vfs_ops.disconnect(conn); +} + +static DIR *audit_opendir(struct connection_struct *conn, const char *fname) +{ + DIR *result = default_vfs_ops.opendir(conn, fname); + + syslog(SYSLOG_PRIORITY, "opendir %s %s%s\n", + fname, + (result == NULL) ? "failed: " : "", + (result == NULL) ? strerror(errno) : ""); + + return result; +} + +static int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode) +{ + int result = default_vfs_ops.mkdir(conn, path, mode); + + syslog(SYSLOG_PRIORITY, "mkdir %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +static int audit_rmdir(struct connection_struct *conn, const char *path) +{ + int result = default_vfs_ops.rmdir(conn, path); + + syslog(SYSLOG_PRIORITY, "rmdir %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +static int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode) +{ + int result = default_vfs_ops.open(conn, fname, flags, mode); + + syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n", + fname, result, + ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +static int audit_close(struct files_struct *fsp, int fd) +{ + int result = default_vfs_ops.close(fsp, fd); + + syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n", + fd, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +static int audit_rename(struct connection_struct *conn, const char *old, const char *new) +{ + int result = default_vfs_ops.rename(conn, old, new); + + syslog(SYSLOG_PRIORITY, "rename %s -> %s %s%s\n", + old, new, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +static int audit_unlink(struct connection_struct *conn, const char *path) +{ + int result = default_vfs_ops.unlink(conn, path); + + syslog(SYSLOG_PRIORITY, "unlink %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +static int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode) +{ + int result = default_vfs_ops.chmod(conn, path, mode); + + syslog(SYSLOG_PRIORITY, "chmod %s mode 0x%x %s%s\n", + path, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +static int audit_chmod_acl(struct connection_struct *conn, const char *path, mode_t mode) +{ + int result = default_vfs_ops.chmod_acl(conn, path, mode); + + syslog(SYSLOG_PRIORITY, "chmod_acl %s mode 0x%x %s%s\n", + path, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +static int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode) +{ + int result = default_vfs_ops.fchmod(fsp, fd, mode); + + syslog(SYSLOG_PRIORITY, "fchmod %s mode 0x%x %s%s\n", + fsp->fsp_name, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) +{ + int result = default_vfs_ops.fchmod_acl(fsp, fd, mode); + + syslog(SYSLOG_PRIORITY, "fchmod_acl %s mode 0x%x %s%s\n", + fsp->fsp_name, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c new file mode 100644 index 00000000000..353be36e6f0 --- /dev/null +++ b/source3/modules/vfs_netatalk.c @@ -0,0 +1,430 @@ +/* + * AppleTalk VFS module for Samba-3.x + * + * Copyright (C) Alexei Kotovich, 2002 + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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. + */ + +#include "config.h" +#include +#include +#ifdef HAVE_UTIME_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#include +#include +#include +#include + +#define APPLEDOUBLE ".AppleDouble" +#define ADOUBLEMODE 0777 + +/* atalk functions */ + +static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, + const char *fname, char **adbl_path, char **orig_path, + SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info); + +static int atalk_unlink_file(const char *path); + +static struct vfs_ops default_vfs_ops; /* For passthrough operation */ +static struct smb_vfs_handle_struct *atalk_handle; + +static int atalk_get_path_ptr(char *path) +{ + int i = 0; + int ptr = 0; + + for (i = 0; path[i]; i ++) { + if (path[i] == '/') + ptr = i; + /* get out some 'spam';) from win32's file name */ + else if (path[i] == ':') { + path[i] = '\0'; + break; + } + } + + return ptr; +} + +static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, const char *fname, + char **adbl_path, char **orig_path, + SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info) +{ + int ptr0 = 0; + int ptr1 = 0; + char *dname = 0; + char *name = 0; + + if (!ctx || !path || !fname || !adbl_path || !orig_path || + !adbl_info || !orig_info) + return -1; +#if 0 + DEBUG(3, ("ATALK: PATH: %s[%s]\n", path, fname)); +#endif + if (strstr(path, APPLEDOUBLE) || strstr(fname, APPLEDOUBLE)) { + DEBUG(3, ("ATALK: path %s[%s] already contains %s\n", path, fname, APPLEDOUBLE)); + return -1; + } + + if (fname[0] == '.') ptr0 ++; + if (fname[1] == '/') ptr0 ++; + + *orig_path = talloc_asprintf(ctx, "%s/%s", path, &fname[ptr0]); + + /* get pointer to last '/' */ + ptr1 = atalk_get_path_ptr(*orig_path); + + sys_lstat(*orig_path, orig_info); + + if (S_ISDIR(orig_info->st_mode)) { + *adbl_path = talloc_asprintf(ctx, "%s/%s/%s/", + path, &fname[ptr0], APPLEDOUBLE); + } else { + dname = talloc_strdup(ctx, *orig_path); + dname[ptr1] = '\0'; + name = *orig_path; + *adbl_path = talloc_asprintf(ctx, "%s/%s/%s", + dname, APPLEDOUBLE, &name[ptr1 + 1]); + } +#if 0 + DEBUG(3, ("ATALK: DEBUG:\n%s\n%s\n", *orig_path, *adbl_path)); +#endif + sys_lstat(*adbl_path, adbl_info); + return 0; +} + +static int atalk_unlink_file(const char *path) +{ + int ret = 0; + + become_root(); + ret = unlink(path); + unbecome_root(); + + return ret; +} + +static void atalk_add_to_list(name_compare_entry **list) +{ + int i, count = 0; + name_compare_entry *new_list = 0; + name_compare_entry *cur_list = 0; + + cur_list = *list; + + if (cur_list) { + for (i = 0, count = 0; cur_list[i].name; i ++, count ++) { + if (strstr(cur_list[i].name, APPLEDOUBLE)) + return; + } + } + + if (!(new_list = calloc(1, + (count == 0 ? 1 : count + 1) * sizeof(name_compare_entry)))) + return; + + for (i = 0; i < count; i ++) { + new_list[i].name = strdup(cur_list[i].name); + new_list[i].is_wild = cur_list[i].is_wild; + } + + new_list[i].name = strdup(APPLEDOUBLE); + new_list[i].is_wild = False; + + free_namearray(*list); + + *list = new_list; + new_list = 0; + cur_list = 0; +} + +static void atalk_rrmdir(TALLOC_CTX *ctx, char *path) +{ + int n; + char *dpath; + struct dirent **namelist; + + if (!path) return; + + n = scandir(path, &namelist, 0, alphasort); + if (n < 0) { + return; + } else { + while (n --) { + if (strcmp(namelist[n]->d_name, ".") == 0 || + strcmp(namelist[n]->d_name, "..") == 0) + continue; + if (!(dpath = talloc_asprintf(ctx, "%s/%s", + path, namelist[n]->d_name))) + continue; + atalk_unlink_file(dpath); + free(namelist[n]); + } + } +} + +/* Disk operations */ + +/* Directory operations */ + +DIR *atalk_opendir(struct connection_struct *conn, const char *fname) +{ + DIR *ret = 0; + + ret = default_vfs_ops.opendir(conn, fname); + + /* + * when we try to perform delete operation upon file which has fork + * in ./.AppleDouble and this directory wasn't hidden by Samba, + * MS Windows explorer causes the error: "Cannot find the specified file" + * There is some workaround to avoid this situation, i.e. if + * connection has not .AppleDouble entry in either veto or hide + * list then it would be nice to add one. + */ + + atalk_add_to_list(&conn->hide_list); + atalk_add_to_list(&conn->veto_list); + + return ret; +} + +static int atalk_rmdir(struct connection_struct *conn, const char *path) +{ + BOOL add = False; + TALLOC_CTX *ctx = 0; + char *dpath; + + if (!conn || !conn->origpath || !path) goto exit_rmdir; + + /* due to there is no way to change bDeleteVetoFiles variable + * from this module, gotta use talloc stuff.. + */ + + strstr(path, APPLEDOUBLE) ? (add = False) : (add = True); + + if (!(ctx = talloc_init_named("remove_directory"))) + goto exit_rmdir; + + if (!(dpath = talloc_asprintf(ctx, "%s/%s%s", + conn->origpath, path, add ? "/"APPLEDOUBLE : ""))) + goto exit_rmdir; + + atalk_rrmdir(ctx, dpath); + +exit_rmdir: + talloc_destroy(ctx); + return default_vfs_ops.rmdir(conn, path); +} + +/* File operations */ + +static int atalk_rename(struct connection_struct *conn, const char *old, const char *new) +{ + int ret = 0; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.rename(conn, old, new); + + if (!conn || !old) return ret; + + if (!(ctx = talloc_init_named("rename_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, old, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); + goto exit_rename; + } + + atalk_unlink_file(adbl_path); + +exit_rename: + talloc_destroy(ctx); + return ret; +} + +static int atalk_unlink(struct connection_struct *conn, const char *path) +{ + int ret = 0, i; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.unlink(conn, path); + + if (!conn || !path) return ret; + + /* no .AppleDouble sync if veto or hide list is empty, + * otherwise "Cannot find the specified file" error will be caused + */ + + if (!conn->veto_list) return ret; + if (!conn->hide_list) return ret; + + for (i = 0; conn->veto_list[i].name; i ++) { + if (strstr(conn->veto_list[i].name, APPLEDOUBLE)) + break; + } + + if (!conn->veto_list[i].name) { + for (i = 0; conn->hide_list[i].name; i ++) { + if (strstr(conn->hide_list[i].name, APPLEDOUBLE)) + break; + else { + DEBUG(3, ("ATALK: %s is not hidden, skipped..\n", + APPLEDOUBLE)); + return ret; + } + } + } + + if (!(ctx = talloc_init_named("unlink_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); + goto exit_unlink; + } + + atalk_unlink_file(adbl_path); + +exit_unlink: + talloc_destroy(ctx); + return ret; +} + +static int atalk_chmod(struct connection_struct *conn, const char *path, mode_t mode) +{ + int ret = 0; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.chmod(conn, path, mode); + + if (!conn || !path) return ret; + + if (!(ctx = talloc_init_named("chmod_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); + goto exit_chmod; + } + + chmod(adbl_path, ADOUBLEMODE); + +exit_chmod: + talloc_destroy(ctx); + return ret; +} + +static int atalk_chown(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid) +{ + int ret = 0; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.chown(conn, path, uid, gid); + + if (!conn || !path) return ret; + + if (!(ctx = talloc_init_named("chown_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); + goto exit_chown; + } + + chown(adbl_path, uid, gid); + +exit_chown: + talloc_destroy(ctx); + return ret; +} + +static vfs_op_tuple atalk_ops[] = { + + /* Directory operations */ + + {atalk_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, + + /* File operations */ + + {atalk_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_chown, SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, + + /* Finish VFS operations definition */ + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle) +{ + *vfs_version = SMB_VFS_INTERFACE_VERSION; + memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + atalk_handle = vfs_handle; + + DEBUG(3, ("ATALK: vfs module loaded\n")); + return atalk_ops; +} + +/* VFS finalization function. */ +void vfs_done(connection_struct *conn) +{ + DEBUG(3, ("ATALK: vfs module unloaded\n")); +} diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c new file mode 100644 index 00000000000..b59cb92a28f --- /dev/null +++ b/source3/modules/vfs_recycle.c @@ -0,0 +1,559 @@ +/* + * Recycle bin VFS module for Samba. + * + * Copyright (C) 2001, Brandon Stone, Amherst College, . + * Copyright (C) 2002, Jeremy Allison - modified to make a VFS module. + * Copyright (C) 2002, Alexander Bokovoy - cascaded VFS adoption, + * Copyright (C) 2002, Juergen Hasch - added some options. + * Copyright (C) 2002, Simo Sorce + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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. + */ + +#include "includes.h" + +#define ALLOC_CHECK(ptr, label) do { if ((ptr) == NULL) { DEBUG(0, ("recycle.bin: out of memory!\n")); errno = ENOMEM; goto label; } } while(0) + +static int vfs_recycle_debug_level = DBGC_VFS; + +#undef DBGC_CLASS +#define DBGC_CLASS vfs_recycle_debug_level + +static const char *delimiter = "|"; /* delimiter for options */ + +/* One per connection */ + +typedef struct recycle_bin_struct +{ + TALLOC_CTX *ctx; + char *repository; /* name of the recycle bin directory */ + BOOL keep_dir_tree; /* keep directory structure of deleted file in recycle bin */ + BOOL versions; /* create versions of deleted files with identical name */ + BOOL touch; /* touch access date of deleted file */ + char *exclude; /* which files to exclude */ + char *exclude_dir; /* which directories to exclude */ + char *noversions; /* which files to exclude from versioning */ + SMB_OFF_T maxsize; /* maximum file size to be saved */ +} recycle_bin_struct; + +/* VFS operations */ +static struct vfs_ops default_vfs_ops; /* For passthrough operation */ + +static int recycle_connect(struct connection_struct *conn, const char *service, const char *user); +static void recycle_disconnect(struct connection_struct *conn); +static int recycle_unlink(connection_struct *, const char *); + +#define VFS_OP(x) ((void *) x) + +static vfs_op_tuple recycle_ops[] = { + + /* Disk operations */ + {VFS_OP(recycle_connect), SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, + {VFS_OP(recycle_disconnect), SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_TRANSPARENT}, + + /* File operations */ + {VFS_OP(recycle_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +static BOOL check_bool_param(const char *value) +{ + if (strwicmp(value, "yes") == 0 || + strwicmp(value, "true") == 0 || + strwicmp(value, "1") == 0) + return True; + + return False; +} + +/** + * VFS initialisation function. + * + * @retval initialised vfs_op_tuple array + **/ +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle) +{ + DEBUG(10, ("Initializing VFS module recycle\n")); + *vfs_version = SMB_VFS_INTERFACE_VERSION; + memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); + vfs_recycle_debug_level = debug_add_class("vfs_recycle_bin"); + if (vfs_recycle_debug_level == -1) { + vfs_recycle_debug_level = DBGC_VFS; + DEBUG(0, ("vfs_recycle: Couldn't register custom debugging class!\n")); + } else { + DEBUG(0, ("vfs_recycle: Debug class number of 'vfs_recycle': %d\n", vfs_recycle_debug_level)); + } + + return recycle_ops; +} + +/** + * VFS finalization function. + * + **/ +void vfs_done(connection_struct *conn) +{ + DEBUG(10,("Called for connection %d\n", SNUM(conn))); +} + +static int recycle_connect(struct connection_struct *conn, const char *service, const char *user) +{ + TALLOC_CTX *ctx = NULL; + recycle_bin_struct *recbin; + char *servicename; + char *tmp_str; + + DEBUG(10, ("Called for service %s (%d) as user %s\n", service, SNUM(conn), user)); + + if (!(ctx = talloc_init_named("recycle bin"))) { + DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n")); + return 0; + } + + recbin = talloc(ctx,sizeof(recycle_bin_struct)); + if ( recbin == NULL) { + DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n")); + return -1; + } + recbin->ctx = ctx; + + /* Set defaults */ + recbin->repository = talloc_strdup(ctx, ".recycle"); + ALLOC_CHECK(recbin->repository, error); + recbin->keep_dir_tree = False; + recbin->versions = False; + recbin->touch = False; + recbin->exclude = ""; + recbin->exclude_dir = ""; + recbin->noversions = ""; + recbin->maxsize = 0; + + /* parse configuration options */ + servicename = talloc_strdup(recbin->ctx, lp_servicename(SNUM(conn))); + DEBUG(10, ("servicename = %s\n",servicename)); + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "repository")) != NULL) { + recbin->repository = talloc_sub_conn(ctx, conn, tmp_str); + ALLOC_CHECK(recbin->repository, error); + trim_string(recbin->repository, "/", "/"); + DEBUG(5, ("recycle.bin: repository = %s\n", recbin->repository)); + } + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "keeptree")) != NULL) { + if (check_bool_param(tmp_str) == True) + recbin->keep_dir_tree = True; + DEBUG(5, ("recycle.bin: keeptree = %s\n", tmp_str)); + } + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "versions")) != NULL) { + if (check_bool_param(tmp_str) == True) + recbin->versions = True; + DEBUG(5, ("recycle.bin: versions = %s\n", tmp_str)); + } + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "touch")) != NULL) { + if (check_bool_param(tmp_str) == True) + recbin->touch = True; + DEBUG(5, ("recycle.bin: touch = %s\n", tmp_str)); + } + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "maxsize")) != NULL) { + recbin->maxsize = strtoul(tmp_str, NULL, 10); + if (recbin->maxsize == 0) { + recbin->maxsize = -1; + DEBUG(5, ("recycle.bin: maxsize = -infinite-\n")); + } else { + DEBUG(5, ("recycle.bin: maxsize = %ld\n", (long int)recbin->maxsize)); + } + } + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "exclude")) != NULL) { + recbin->exclude = talloc_strdup(ctx, tmp_str); + ALLOC_CHECK(recbin->exclude, error); + DEBUG(5, ("recycle.bin: exclude = %s\n", recbin->exclude)); + } + if ((tmp_str = lp_parm_string(servicename,"vfs_recycle_bin", "exclude_dir")) != NULL) { + recbin->exclude_dir = talloc_strdup(ctx, tmp_str); + ALLOC_CHECK(recbin->exclude_dir, error); + DEBUG(5, ("recycle.bin: exclude_dir = %s\n", recbin->exclude_dir)); + } + if ((tmp_str = lp_parm_string(servicename,"vfs_recycle_bin", "noversions")) != NULL) { + recbin->noversions = talloc_strdup(ctx, tmp_str); + ALLOC_CHECK(recbin->noversions, error); + DEBUG(5, ("recycle.bin: noversions = %s\n", recbin->noversions)); + } + + conn->vfs_private = (void *)recbin; + return default_vfs_ops.connect(conn, service, user); + +error: + talloc_destroy(ctx); + return -1; +} + +static void recycle_disconnect(struct connection_struct *conn) +{ + DEBUG(10, ("Disconnecting VFS module recycle bin\n")); + if (conn->vfs_private) { + talloc_destroy(((recycle_bin_struct *)conn->vfs_private)->ctx); + conn->vfs_private = NULL; + } + default_vfs_ops.disconnect(conn); +} + +static BOOL recycle_directory_exist(connection_struct *conn, const char *dname) +{ + SMB_STRUCT_STAT st; + + if (default_vfs_ops.stat(conn, dname, &st) == 0) { + if (S_ISDIR(st.st_mode)) { + return True; + } + } + + return False; +} + +static BOOL recycle_file_exist(connection_struct *conn, const char *fname) +{ + SMB_STRUCT_STAT st; + + if (default_vfs_ops.stat(conn, fname, &st) == 0) { + if (S_ISREG(st.st_mode)) { + return True; + } + } + + return False; +} + +/** + * Return file size + * @param conn connection + * @param fname file name + * @return size in bytes + **/ +static SMB_OFF_T recycle_get_file_size(connection_struct *conn, const char *fname) +{ + SMB_STRUCT_STAT st; + if (default_vfs_ops.stat(conn, fname, &st) != 0) { + DEBUG(0,("recycle.bin: stat for %s returned %s\n", fname, strerror(errno))); + return (SMB_OFF_T)0; + } + return(st.st_size); +} + +/** + * Create directory tree + * @param conn connection + * @param dname Directory tree to be created + * @return Returns True for success + **/ +static BOOL recycle_create_dir(connection_struct *conn, const char *dname) +{ + int len; + mode_t mode; + char *new_dir = NULL; + char *tmp_str = NULL; + char *token; + char *tok_str; + BOOL ret = False; + + mode = S_IREAD | S_IWRITE | S_IEXEC; + + tmp_str = strdup(dname); + ALLOC_CHECK(tmp_str, done); + tok_str = tmp_str; + + len = strlen(dname); + new_dir = (char *)malloc(len + 1); + ALLOC_CHECK(new_dir, done); + *new_dir = '\0'; + + /* Create directory tree if neccessary */ + for(token = strtok(tok_str, "/"); token; token = strtok(NULL, "/")) { + safe_strcat(new_dir, token, len); + if (recycle_directory_exist(conn, new_dir)) + DEBUG(10, ("recycle.bin: dir %s already exists\n", new_dir)); + else { + DEBUG(5, ("recycle.bin: creating new dir %s\n", new_dir)); + if (default_vfs_ops.mkdir(conn, new_dir, mode) != 0) { + DEBUG(1,("recycle.bin: mkdir failed for %s with error: %s\n", new_dir, strerror(errno))); + ret = False; + goto done; + } + } + safe_strcat(new_dir, "/", len); + } + + ret = True; +done: + SAFE_FREE(tmp_str); + SAFE_FREE(new_dir); + return ret; +} + +/** + * Check if needle is contained exactly in haystack + * @param haystack list of parameters separated by delimimiter character + * @param needle string to be matched exactly to haystack + * @return True if found + **/ +static BOOL checkparam(const char *haystack, const char *needle) +{ + char *token; + char *tok_str; + char *tmp_str; + BOOL ret = False; + + if (haystack == NULL || strlen(haystack) == 0 || needle == NULL || strlen(needle) == 0) { + return False; + } + + tmp_str = strdup(haystack); + ALLOC_CHECK(tmp_str, done); + token = tok_str = tmp_str; + + for(token = strtok(tok_str, delimiter); token; token = strtok(NULL, delimiter)) { + if(strcmp(token, needle) == 0) { + ret = True; + goto done; + } + } +done: + SAFE_FREE(tmp_str); + return ret; +} + +/** + * Check if needle is contained in haystack, * and ? patterns are resolved + * @param haystack list of parameters separated by delimimiter character + * @param needle string to be matched exectly to haystack including pattern matching + * @return True if found + **/ +static BOOL matchparam(const char *haystack, const char *needle) +{ + char *token; + char *tok_str; + char *tmp_str; + BOOL ret = False; + + if (haystack == NULL || strlen(haystack) == 0 || needle == NULL || strlen(needle) == 0) { + return False; + } + + tmp_str = strdup(haystack); + ALLOC_CHECK(tmp_str, done); + token = tok_str = tmp_str; + + for(token = strtok(tok_str, delimiter); token; token = strtok(NULL, delimiter)) { + if (!unix_wild_match(token, needle)) { + ret = True; + goto done; + } + } +done: + SAFE_FREE(tmp_str); + return ret; +} + +/** + * Touch access date + **/ +static void recycle_touch(connection_struct *conn, const char *fname) +{ + SMB_STRUCT_STAT st; + struct utimbuf tb; + time_t currtime; + + if (default_vfs_ops.stat(conn, fname, &st) != 0) { + DEBUG(0,("recycle.bin: stat for %s returned %s\n", fname, strerror(errno))); + return; + } + currtime = time(&currtime); + tb.actime = currtime; + tb.modtime = st.st_mtime; + + if (default_vfs_ops.utime(conn, fname, &tb) == -1 ) + DEBUG(0, ("recycle.bin: touching %s failed, reason = %s\n", fname, strerror(errno))); + } + +/** + * Check if file should be recycled + **/ +static int recycle_unlink(connection_struct *conn, const char *inname) +{ + recycle_bin_struct *recbin; + char *file_name = NULL; + char *path_name = NULL; + char *temp_name = NULL; + char *final_name = NULL; + char *base; + int i; + SMB_BIG_UINT dfree, dsize, bsize; + SMB_OFF_T file_size, space_avail; + BOOL exist; + int rc = -1; + + file_name = strdup(inname); + ALLOC_CHECK(file_name, done); + + if (conn->vfs_private) + recbin = (recycle_bin_struct *)conn->vfs_private; + else { + DEBUG(0, ("Recycle bin not initialized!\n")); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + + if(!recbin->repository || *(recbin->repository) == '\0') { + DEBUG(3, ("Recycle path not set, purging %s...\n", file_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + + /* we don't recycle the recycle bin... */ + if (strncmp(file_name, recbin->repository, strlen(recbin->repository)) == 0) { + DEBUG(3, ("File is within recycling bin, unlinking ...\n")); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + + file_size = recycle_get_file_size(conn, file_name); + /* it is wrong to purge filenames only because they are empty imho + * --- simo + * + if(fsize == 0) { + DEBUG(3, ("File %s is empty, purging...\n", file_name)); + rc = default_vfs_ops.unlink(conn,file_name); + goto done; + } + */ + + /* FIXME: this is wrong, we should check the hole size of the recycle bin is + * not greater then maxsize, not the size of the single file, also it is better + * to remove older files + */ + if(recbin->maxsize > 0 && file_size > recbin->maxsize) { + DEBUG(3, ("File %s exceeds maximum recycle size, purging... \n", file_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + + /* FIXME: this is wrong: moving files with rename does not change the disk space + * allocation + * + space_avail = default_vfs_ops.disk_free(conn, ".", True, &bsize, &dfree, &dsize) * 1024L; + DEBUG(5, ("space_avail = %Lu, file_size = %Lu\n", space_avail, file_size)); + if(space_avail < file_size) { + DEBUG(3, ("Not enough diskspace, purging file %s\n", file_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + */ + + /* extract filename and path */ + path_name = (char *)malloc(PATH_MAX); + ALLOC_CHECK(path_name, done); + *path_name = '\0'; + safe_strcpy(path_name, file_name, PATH_MAX); + base = strrchr(path_name, '/'); + if (base == NULL) { + base = file_name; + safe_strcpy(path_name, "/", PATH_MAX); + } + else { + *base = '\0'; + base++; + } + + DEBUG(10, ("recycle.bin: fname = %s\n", file_name)); /* original filename with path */ + DEBUG(10, ("recycle.bin: fpath = %s\n", path_name)); /* original path */ + DEBUG(10, ("recycle.bin: base = %s\n", base)); /* filename without path */ + + if (matchparam(recbin->exclude, base)) { + DEBUG(3, ("recycle.bin: file %s is excluded \n", base)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + + /* FIXME: this check will fail if we have more than one level of directories, + * we shoud check for every level 1, 1/2, 1/2/3, 1/2/3/4 .... + * ---simo + */ + if (checkparam(recbin->exclude_dir, path_name)) { + DEBUG(3, ("recycle.bin: directory %s is excluded \n", path_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + + temp_name = (char *)malloc(PATH_MAX); + ALLOC_CHECK(temp_name, done); + safe_strcpy(temp_name, recbin->repository, PATH_MAX); + + /* see if we need to recreate the original directory structure in the recycle bin */ + if (recbin->keep_dir_tree == True) { + safe_strcat(temp_name, "/", PATH_MAX); + safe_strcat(temp_name, path_name, PATH_MAX); + } + + exist = recycle_directory_exist(conn, temp_name); + if (exist) { + DEBUG(10, ("recycle.bin: Directory already exists\n")); + } else { + DEBUG(10, ("recycle.bin: Creating directory %s\n", temp_name)); + if (recycle_create_dir(conn, temp_name) == False) { + DEBUG(3, ("Could not create directory, purging %s...\n", file_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + } + + final_name = (char *)malloc(PATH_MAX); + ALLOC_CHECK(final_name, done); + snprintf(final_name, PATH_MAX, "%s/%s", temp_name, base); + DEBUG(10, ("recycle.bin: recycled file name%s\n", temp_name)); /* new filename with path */ + + /* check if we should delete file from recycle bin */ + if (recycle_file_exist(conn, final_name)) { + if (recbin->versions == False || matchparam(recbin->noversions, base) == True) { + DEBUG(3, ("recycle.bin: Removing old file %s from recycle bin\n", final_name)); + if (default_vfs_ops.unlink(conn, final_name) != 0) { + DEBUG(1, ("recycle.bin: Error deleting old file: %s\n", strerror(errno))); + } + } + } + + /* rename file we move to recycle bin */ + i = 1; + while (recycle_file_exist(conn, final_name)) { + snprintf(final_name, PATH_MAX, "%s/Copy #%d of %s", temp_name, i++, base); + } + + DEBUG(10, ("recycle.bin: Moving %s to %s\n", file_name, final_name)); + rc = default_vfs_ops.rename(conn, file_name, final_name); + if (rc != 0) { + DEBUG(3, ("recycle.bin: Move error %d (%s), purging file %s (%s)\n", errno, strerror(errno), file_name, final_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + + /* touch access date of moved file */ + if (recbin->touch == True ) + recycle_touch(conn, final_name); + +done: + SAFE_FREE(file_name); + SAFE_FREE(path_name); + SAFE_FREE(temp_name); + SAFE_FREE(final_name); + return rc; +} -- cgit From 828df6be66436d9f839324c54070d12335a869c1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 13:19:24 +0000 Subject: Add make target 'modules' that currently builds vfs_audit, vfs_recycle and vfs_netatalk (This used to be commit 4c05cbbe7434c9d43f561f3be27c0283fa754ab0) --- source3/Makefile.in | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index b6c5c367645..a43ea93908f 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -116,6 +116,8 @@ SCRIPTS = $(srcdir)/script/smbtar $(srcdir)/script/addtosmbpass $(srcdir)/script QUOTAOBJS=@QUOTAOBJS@ +MODULES = bin/vfs_audit.so bin/vfs_recycle.so bin/vfs_netatalk.so + ###################################################################### # object file lists ###################################################################### @@ -227,6 +229,7 @@ PASSDB_OBJ = $(PASSDB_GET_SET_OBJ) passdb/passdb.o passdb/pdb_interface.o \ PDB_XML_OBJ = passdb/pdb_xml.o PDB_MYSQL_OBJ = passdb/pdb_mysql.o +DEVEL_HELP_OBJ = modules/developer.o SAM_STATIC_MODULES = sam/sam_plugin.o sam/sam_skel.o sam/sam_ads.o @@ -431,8 +434,9 @@ NSSTEST_OBJ = torture/nsstest.o $(LIBSMB_OBJ) $(PARAM_OBJ) \ VFSTEST_OBJ = torture/cmd_vfs.o torture/vfstest.o $(SMBD_OBJ_BASE) $(READLINE_OBJ) -VFS_AUDIT_OBJ = vfs/audit.o -VFS_RECYCLE_OBJ = vfs/recycle.o +VFS_AUDIT_OBJ = modules/vfs_audit.o +VFS_RECYCLE_OBJ = modules/vfs_recycle.o +VFS_NETATALK_OBJ = modules/vfs_netatalk.o LOCKTEST2_OBJ = torture/locktest2.o $(LOCKING_OBJ) $(LIBSMB_OBJ) $(PARAM_OBJ) \ $(UBIQX_OBJ) $(LIB_OBJ) @@ -555,7 +559,9 @@ nsswitch : SHOWFLAGS $(WINBIND_PROGS) $(WINBIND_SPROGS) $(LPROGS) wins : SHOWFLAGS nsswitch/libnss_wins.@SHLIBEXT@ -everything: all libsmbclient debug2html smbfilter talloctort +modules: SHOWFLAGS $(MODULES) + +everything: all libsmbclient debug2html smbfilter talloctort .SUFFIXES: .SUFFIXES: .c .o .po .po32 .lo @@ -820,6 +826,11 @@ bin/pdb_mysql.@SHLIBEXT@: $(PDB_MYSQL_OBJ) @$(SHLD) $(LDSHFLAGS) -o $@ $(PDB_MYSQL_OBJ) @MYSQL_LIBS@ \ @SONAMEFLAG@`basename $@` +bin/developer.@SHLIBEXT@: $(DEVEL_HELP_OBJ) + @echo "Building plugin $@" + @$(SHLD) $(LDSHFLAGS) -o $@ $(DEVEL_HELP_OBJ) \ + @SONAMEFLAG@`basename $@` + bin/pdb_xml.@SHLIBEXT@: $(PDB_XML_OBJ) @echo "Building plugin $@" @$(SHLD) $(LDSHFLAGS) -o $@ $(PDB_XML_OBJ) @XML_LIBS@ \ @@ -835,6 +846,11 @@ bin/vfs_recycle.@SHLIBEXT@: $(VFS_RECYCLE_OBJ) @$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_RECYCLE_OBJ) \ @SONAMEFLAG@`basename $@` +bin/vfs_netatalk.@SHLIBEXT@: $(VFS_NETATALK_OBJ) + @echo "Building plugin $@" + @$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_NETATALK_OBJ) \ + @SONAMEFLAG@`basename $@` + bin/wbinfo: $(WBINFO_OBJ) $(PARAM_OBJ) $(LIB_OBJ) \ $(UBIQX_OBJ) $(SECRETS_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ -- cgit From 34cd7f18403154a4c9e0d967c639b7a9b07cbf6e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 13:23:02 +0000 Subject: Don't build Makefile.in in examples/VFS/ (This used to be commit 98cb778cb7d48dd545b5dcf395567defd0198f86) --- source3/configure | 2073 ++++++++++++-------------------------------------- source3/configure.in | 2 +- 2 files changed, 469 insertions(+), 1606 deletions(-) diff --git a/source3/configure b/source3/configure index 73baed25441..8d160b87b35 100755 --- a/source3/configure +++ b/source3/configure @@ -1,19 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.53. +# Generated by GNU Autoconf 2.54. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - - ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -22,11 +14,13 @@ fi if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi -# NLS nuisances. # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset @@ -34,34 +28,39 @@ else as_unset=false fi -(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && - { $as_unset LANG || test "${LANG+set}" != set; } || - { LANG=C; export LANG; } -(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && - { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || - { LC_ALL=C; export LC_ALL; } -(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && - { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || - { LC_TIME=C; export LC_TIME; } -(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && - { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || - { LC_CTYPE=C; export LC_CTYPE; } -(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && - { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || - { LANGUAGE=C; export LANGUAGE; } -(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && - { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || - { LC_COLLATE=C; export LC_COLLATE; } -(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && - { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || - { LC_NUMERIC=C; export LC_NUMERIC; } -(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && - { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || - { LC_MESSAGES=C; export LC_MESSAGES; } + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi # Name of the executable. -as_me=`(basename "$0") 2>/dev/null || +as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ @@ -72,6 +71,7 @@ echo X/"$0" | /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` + # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -85,7 +85,7 @@ if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh - if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: @@ -138,6 +138,8 @@ do as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} @@ -210,6 +212,12 @@ else fi rm -f conf$$ conf$$.exe conf$$.file +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. @@ -226,7 +234,7 @@ as_nl=' IFS=" $as_nl" # CDPATH. -$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } +$as_unset CDPATH # Name of the host. @@ -240,6 +248,7 @@ exec 6>&1 # Initializations. # ac_default_prefix=/usr/local +ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= @@ -297,6 +306,8 @@ ac_includes_default="\ # include #endif" +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configdir lockdir piddir logfilebase privatedir swatdir RUNPROG MPROGS LDSHFLAGS SONAMEFLAG SHLD HOST_OS PAM_MOD WRAP WRAP32 WRAPPROG PICFLAG PICSUFFIX POBAD_CC SHLIBEXT LIBSMBCLIENT_SHARED LIBSMBCLIENT PRINTLIBS AUTHLIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK BROKEN_CC build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CPP EGREP CUPS_CONFIG LIBOBJS TERMLIBS TERMLDFLAGS ROFF DYNEXP MYSQL_CONFIG MYSQL_CFLAGS MYSQL_LIBS XML2_CONFIG XML_CFLAGS XML_LIBS QUOTAOBJS manlangs WINBIND_TARGETS WINBIND_STARGETS WINBIND_LTARGETS WINBIND_PAM_TARGETS WINBIND_NSS_EXTRA_OBJS WINBIND_NSS_EXTRA_LIBS BUILD_POPT FLAGS1 PYTHON builddir LTLIBOBJS' +ac_subst_files='' # Initialize some variables set by options. ac_init_help= @@ -720,6 +731,9 @@ if test ! -r $srcdir/$ac_unique_file; then { (exit 1); exit 1; }; } fi fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias @@ -928,7 +942,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -968,7 +982,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.53. Invocation command line was +generated by GNU Autoconf 2.54. Invocation command line was $ $0 $@ @@ -1034,12 +1048,9 @@ do *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - ac_sep=" " ;; - esac + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. + ac_sep=" " done # When interrupted or exit'd, cleanup temporary files, and complete @@ -1051,6 +1062,7 @@ trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo + cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## @@ -1073,6 +1085,35 @@ _ASBOX esac; } echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## @@ -1080,7 +1121,7 @@ _ASBOX ## ----------- ## _ASBOX echo - sed "/^$/d" confdefs.h + sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && @@ -1237,7 +1278,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_config_headers="$ac_config_headers include/config.h" + + ac_config_headers="$ac_config_headers include/config.h" ################################################# @@ -1666,9 +1708,7 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$as_dir/$ac_word" ${1+"$@"} - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi @@ -1801,12 +1841,6 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1835,11 +1869,10 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= -for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; - ls a.out conftest 2>/dev/null; - ls a.* conftest.* 2>/dev/null`; do +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.*; do + test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; a.out ) # We found the default executable, but exeext='' is most # certainly right. break;; @@ -1853,8 +1886,10 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 -echo "$as_me: error: C compiler cannot create executables" >&2;} +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +check \`config.log' for details." >&5 +echo "$as_me: error: C compiler cannot create executables +check \`config.log' for details." >&2;} { (exit 77); exit 77; }; } fi @@ -1911,9 +1946,10 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. -for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; @@ -1942,12 +1978,6 @@ else #line $LINENO "configure" #include "confdefs.h" -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1964,7 +1994,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac @@ -1992,12 +2022,6 @@ else #line $LINENO "configure" #include "confdefs.h" -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2046,12 +2070,6 @@ else #line $LINENO "configure" #include "confdefs.h" -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2097,6 +2115,97 @@ else CFLAGS= fi fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide @@ -2132,12 +2241,6 @@ do #include "confdefs.h" #include $ac_declaration -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2169,12 +2272,6 @@ rm -f conftest.$ac_objext conftest.$ac_ext #line $LINENO "configure" #include "confdefs.h" $ac_declaration -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2399,12 +2496,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strerror (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2445,12 +2536,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strerror (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2506,12 +2591,6 @@ else #line $LINENO "configure" #include "confdefs.h" -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2600,12 +2679,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2992,7 +3065,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) SINIX_LFS_SUPPORT=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CPPFLAGS="$old_CPPFLAGS" if test x$SINIX_LFS_SUPPORT = xyes ; then @@ -3079,7 +3152,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) LINUX_LFS_SUPPORT=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CPPFLAGS="$old_CPPFLAGS" if test x$LINUX_LFS_SUPPORT = xyes ; then @@ -3144,7 +3217,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) GLIBC_LFS_SUPPORT=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CPPFLAGS="$old_CPPFLAGS" if test x$GLIBC_LFS_SUPPORT = xyes ; then @@ -3166,103 +3239,6 @@ echo "${ECHO_T}$GLIBC_LFS_SUPPORT" >&6 esac -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - echo "$as_me:$LINENO: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6 if test "${ac_cv_c_inline+set}" = set; then @@ -3274,8 +3250,9 @@ for ac_kw in inline __inline__ __inline; do #line $LINENO "configure" #include "confdefs.h" #ifndef __cplusplus -static $ac_kw int static_foo () {return 0; } -$ac_kw int foo () {return 0; } +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } #endif _ACEOF @@ -3349,7 +3326,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3382,7 +3359,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3440,7 +3417,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3473,7 +3450,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3516,6 +3493,21 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then @@ -3533,7 +3525,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3564,7 +3556,7 @@ if test $ac_cv_header_stdc = yes; then _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then + $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no @@ -3582,7 +3574,7 @@ if test $ac_cv_header_stdc = yes; then _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then + $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no @@ -3641,7 +3633,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -3674,12 +3666,6 @@ else #include #include <$ac_hdr> -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -3740,12 +3726,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -3786,12 +3766,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -3849,12 +3823,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -3895,12 +3863,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -3953,12 +3915,6 @@ else #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -4015,12 +3971,6 @@ else # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -4179,7 +4129,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4299,7 +4249,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4417,7 +4367,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4537,7 +4487,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4658,7 +4608,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4777,7 +4727,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4896,7 +4846,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5014,7 +4964,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5129,7 +5079,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5199,12 +5149,6 @@ case "$host_os" in #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -5300,7 +5244,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5419,7 +5363,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5534,7 +5478,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5650,7 +5594,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5766,7 +5710,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -5884,7 +5828,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -6000,7 +5944,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -6116,7 +6060,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -6185,12 +6129,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6241,12 +6179,6 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6275,12 +6207,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6323,12 +6249,6 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6357,12 +6277,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6413,12 +6327,6 @@ while test "x$ac_lo" != "x$ac_hi"; do #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6469,12 +6377,6 @@ long longval () { return (long) (sizeof (int)); } unsigned long ulongval () { return (long) (sizeof (int)); } #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6523,7 +6425,7 @@ cat conftest.$ac_ext >&5 echo "$as_me: error: cannot compute sizeof (int), 77" >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -6547,12 +6449,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6603,12 +6499,6 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6637,12 +6527,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6685,12 +6569,6 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6719,12 +6597,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6775,12 +6647,6 @@ while test "x$ac_lo" != "x$ac_hi"; do #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6831,12 +6697,6 @@ long longval () { return (long) (sizeof (long)); } unsigned long ulongval () { return (long) (sizeof (long)); } #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6885,7 +6745,7 @@ cat conftest.$ac_ext >&5 echo "$as_me: error: cannot compute sizeof (long), 77" >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -6909,12 +6769,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6965,12 +6819,6 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -6999,12 +6847,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7047,12 +6889,6 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7081,12 +6917,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7137,12 +6967,6 @@ while test "x$ac_lo" != "x$ac_hi"; do #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7193,12 +7017,6 @@ long longval () { return (long) (sizeof (short)); } unsigned long ulongval () { return (long) (sizeof (short)); } #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7247,7 +7065,7 @@ cat conftest.$ac_ext >&5 echo "$as_me: error: cannot compute sizeof (short), 77" >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -7272,12 +7090,6 @@ else #line $LINENO "configure" #include "confdefs.h" -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7373,8 +7185,9 @@ for ac_kw in inline __inline__ __inline; do #line $LINENO "configure" #include "confdefs.h" #ifndef __cplusplus -static $ac_kw int static_foo () {return 0; } -$ac_kw int foo () {return 0; } +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } #endif _ACEOF @@ -7426,12 +7239,6 @@ cat >conftest.$ac_ext <<_ACEOF #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7462,12 +7269,6 @@ cat >conftest.$ac_ext <<_ACEOF #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7503,7 +7304,7 @@ else cat conftest.$ac_ext >&5 # It does not; compile a test program. if test "$cross_compiling" = yes; then - # try to guess the endianess by grep'ing values into an object file + # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" @@ -7514,12 +7315,6 @@ void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7540,10 +7335,10 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - if fgrep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi -if fgrep LiTTleEnDian conftest.$ac_objext >/dev/null ; then +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else @@ -7592,7 +7387,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -7609,9 +7404,9 @@ _ACEOF no) ;; *) - { { echo "$as_me:$LINENO: error: unknown endianess + { { echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -echo "$as_me: error: unknown endianess +echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac @@ -7626,12 +7421,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7691,12 +7480,6 @@ extern "C" void (*signal (int, void (*)(int)))(int); void (*signal ()) (); #endif -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7745,7 +7528,7 @@ else _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "uid_t" >/dev/null 2>&1; then + $EGREP "uid_t" >/dev/null 2>&1; then ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no @@ -7777,12 +7560,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7835,12 +7612,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7893,12 +7664,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -7951,12 +7716,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8010,12 +7769,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8042,10 +7795,42 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +static struct stat ac_aggr; +if (sizeof ac_aggr.st_rdev) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_member_struct_stat_st_rdev=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_rdev=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5 echo "${ECHO_T}$ac_cv_member_struct_stat_st_rdev" >&6 if test $ac_cv_member_struct_stat_st_rdev = yes; then @@ -8074,12 +7859,6 @@ else #include #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8127,12 +7906,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8185,12 +7958,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8243,12 +8010,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8301,12 +8062,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8359,12 +8114,6 @@ else #line $LINENO "configure" #include "confdefs.h" $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8497,12 +8246,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8568,12 +8311,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8630,12 +8367,6 @@ else #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8701,12 +8432,6 @@ else #include #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8765,12 +8490,6 @@ else #include #endif #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8825,12 +8544,6 @@ else #include #endif #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8881,12 +8594,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8936,12 +8643,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -8991,12 +8692,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -9046,12 +8741,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -9101,12 +8790,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -9156,12 +8839,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -9211,12 +8888,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -9292,7 +8963,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_have_setresuid=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_have_setresuid" >&5 @@ -9342,7 +9013,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_have_setresgid=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_have_setresgid" >&5 @@ -9367,12 +9038,6 @@ else #line $LINENO "configure" #include "confdefs.h" -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -9424,7 +9089,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_memcmp_working=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 @@ -9458,12 +9123,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -9529,12 +9188,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char crypt (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -9651,7 +9304,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -9765,7 +9418,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -9881,7 +9534,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -9956,12 +9609,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tgetent (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -10016,12 +9663,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char rl_callback_handler_install (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -10144,7 +9785,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -10258,7 +9899,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -10374,7 +10015,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -10449,12 +10090,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tgetent (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -10509,12 +10144,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char rl_callback_handler_install (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -10598,12 +10227,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char rl_completion_matches (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -10674,12 +10297,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -10748,12 +10365,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char printf (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -10816,12 +10427,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char printf (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -10884,12 +10489,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -10952,12 +10551,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11037,12 +10630,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11108,12 +10695,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yp_get_default_domain (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11181,12 +10762,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11281,12 +10856,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11367,12 +10936,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11453,12 +11016,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11537,12 +11094,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11620,12 +11171,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11705,12 +11250,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11788,12 +11327,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11870,12 +11403,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -11956,12 +11483,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12035,12 +11556,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12112,12 +11627,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12190,12 +11699,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12273,12 +11776,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12355,12 +11852,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12432,12 +11923,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12510,12 +11995,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12591,12 +12070,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12674,12 +12147,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12755,12 +12222,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12837,12 +12298,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12916,12 +12371,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -12997,12 +12446,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13079,12 +12522,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13160,12 +12597,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13241,12 +12672,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13320,12 +12745,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13389,12 +12808,6 @@ echo $ECHO_N "checking for stat64 in ... $ECHO_C" >&6 #endif #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13444,12 +12857,6 @@ echo $ECHO_N "checking for lstat64 in ... $ECHO_C" >&6 #endif #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13498,12 +12905,6 @@ echo $ECHO_N "checking for fstat64 in ... $ECHO_C" >&6 #endif #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13562,12 +12963,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dn_expand (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13640,12 +13035,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13711,12 +13100,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char putprpwnam (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13781,12 +13164,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13861,12 +13238,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -13932,12 +13303,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char putprpwnam (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14002,12 +13367,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14083,12 +13442,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14154,12 +13507,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char set_auth_parameters (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14224,12 +13571,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14304,12 +13645,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14375,12 +13710,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char set_auth_parameters (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14445,12 +13774,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14527,12 +13850,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14598,12 +13915,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getspnam (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14668,12 +13979,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14749,12 +14054,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14820,12 +14119,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getspnam (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14890,12 +14183,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -14970,12 +14257,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15041,12 +14322,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getspnam (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15111,12 +14386,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15192,12 +14461,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15263,12 +14526,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char bigcrypt (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15333,12 +14590,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15413,12 +14664,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15484,12 +14729,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char bigcrypt (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15554,12 +14793,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15635,12 +14868,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15706,12 +14933,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getprpwnam (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15776,12 +14997,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15856,12 +15071,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15927,12 +15136,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getprpwnam (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -15997,12 +15200,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -16406,7 +15603,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_have_longlong=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_have_longlong" >&5 @@ -16433,12 +15630,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -16513,7 +15704,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_SIZEOF_OFF_T=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_SIZEOF_OFF_T" >&5 @@ -16565,7 +15756,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_OFF64_T=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_OFF64_T" >&5 @@ -16613,7 +15804,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_SIZEOF_INO_T=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_SIZEOF_INO_T" >&5 @@ -16665,7 +15856,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_INO64_T=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_INO64_T" >&5 @@ -16717,7 +15908,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_DEV64_T=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_DEV64_T" >&5 @@ -16745,12 +15936,6 @@ cat >conftest.$ac_ext <<_ACEOF #endif #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -16827,7 +16012,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_DEVICE_MAJOR_FN=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_DEVICE_MAJOR_FN" >&5 @@ -16878,7 +16063,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_DEVICE_MINOR_FN=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_DEVICE_MINOR_FN" >&5 @@ -16925,7 +16110,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_UNSIGNED_CHAR=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_UNSIGNED_CHAR" >&5 @@ -16950,12 +16135,6 @@ cat >conftest.$ac_ext <<_ACEOF #include #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17006,12 +16185,6 @@ cat >conftest.$ac_ext <<_ACEOF #include #include void seekdir(DIR *d, long loc) { return; } -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17060,12 +16233,6 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17114,12 +16281,6 @@ cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17194,7 +16355,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_GETTIMEOFDAY_TZ=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_GETTIMEOFDAY_TZ" >&5 @@ -17218,12 +16379,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include va_list ap1,ap2; -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17318,7 +16473,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_C99_VSNPRINTF=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_C99_VSNPRINTF" >&5 @@ -17368,7 +16523,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_BROKEN_READDIR=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_BROKEN_READDIR" >&5 @@ -17392,12 +16547,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17465,12 +16614,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17529,12 +16672,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17584,12 +16721,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17639,12 +16770,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17694,12 +16819,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17749,12 +16868,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17804,12 +16917,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17859,12 +16966,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17914,12 +17015,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -17969,12 +17064,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18024,12 +17113,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18080,12 +17163,6 @@ else #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18136,12 +17213,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18218,12 +17289,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char iconv_open (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18320,7 +17385,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_NATIVE_ICONV=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_NATIVE_ICONV" >&5 @@ -18377,7 +17442,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" >&5 @@ -18433,7 +17498,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" >&5 @@ -18491,7 +17556,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_KERNEL_SHARE_MODES=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_KERNEL_SHARE_MODES" >&5 @@ -18518,12 +17583,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18606,7 +17665,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" >&5 @@ -18637,12 +17696,6 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPC_RPC_H) #include #endif -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18694,12 +17747,6 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPC_RPC_H) #include #endif -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18751,12 +17798,6 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPC_RPC_H) #include #endif -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18808,12 +17849,6 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPC_RPC_H) #include #endif -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18870,12 +17905,6 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPC_RPC_H) #include #endif -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -18947,7 +17976,7 @@ cat conftest.$ac_ext >&5 echo "$as_me: error: cant find test code. Aborting config" >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: checking for ftruncate extend" >&5 @@ -18983,7 +18012,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_FTRUNCATE_EXTEND=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_FTRUNCATE_EXTEND" >&5 @@ -19029,7 +18058,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_WORKING_AF_LOCAL=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_WORKING_AF_LOCAL" >&5 @@ -19076,7 +18105,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_BROKEN_GETGROUPS=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_BROKEN_GETGROUPS" >&5 @@ -19107,12 +18136,6 @@ cat >conftest.$ac_ext <<_ACEOF #include "${srcdir-.}/lib/getsmbpass.c" #undef main -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -19196,7 +18219,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_REPLACE_INET_NTOA=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_REPLACE_INET_NTOA" >&5 @@ -19255,7 +18278,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_SECURE_MKSTEMP=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_SECURE_MKSTEMP" >&5 @@ -19302,7 +18325,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_SYSCONF_SC_NGROUPS_MAX=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_SYSCONF_SC_NGROUPS_MAX" >&5 @@ -19348,7 +18371,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_ROOT=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_ROOT" >&5 @@ -19404,7 +18427,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_IFACE_AIX=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_IFACE_AIX" >&5 @@ -19455,7 +18478,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_IFACE_IFCONF=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_IFACE_IFCONF" >&5 @@ -19507,7 +18530,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_IFACE_IFREQ=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_IFACE_IFREQ" >&5 @@ -19563,7 +18586,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_USE_SETRESUID=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_USE_SETRESUID" >&5 @@ -19616,7 +18639,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_USE_SETREUID=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_USE_SETREUID" >&5 @@ -19668,7 +18691,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_USE_SETEUID=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_USE_SETEUID" >&5 @@ -19720,7 +18743,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_USE_SETUIDX=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_USE_SETUIDX" >&5 @@ -19768,7 +18791,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_MMAP=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_MMAP" >&5 @@ -19814,7 +18837,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_FTRUNCATE_NEEDS_ROOT=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_FTRUNCATE_NEEDS_ROOT" >&5 @@ -19860,7 +18883,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_FCNTL_LOCK=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_FCNTL_LOCK" >&5 @@ -19906,7 +18929,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" >&5 @@ -19974,7 +18997,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_STRUCT_FLOCK64=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $samba_cv_HAVE_STRUCT_FLOCK64" >&5 @@ -20001,12 +19024,6 @@ cat >conftest.$ac_ext <<_ACEOF #include #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -20057,12 +19074,6 @@ cat >conftest.$ac_ext <<_ACEOF #include #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -20120,12 +19131,6 @@ cat >conftest.$ac_ext <<_ACEOF #include #endif -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -20179,12 +19184,6 @@ cat >conftest.$ac_ext <<_ACEOF #if defined(HAVE_RPCSVC_NIS_H) #include #endif -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -20490,7 +19489,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -20608,7 +19607,7 @@ _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -20688,12 +19687,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char _et_list (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -20747,12 +19740,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char krb5_encrypt_data (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -20810,12 +19797,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char krb5_mk_req_extended (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -20877,12 +19858,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gss_display_status (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -20969,12 +19944,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char ber_scanf (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -21032,12 +20001,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char ldap_domain2hostlist (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -21106,12 +20069,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -21170,12 +20127,6 @@ else #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -21400,7 +20351,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) no_mysql=yes fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" @@ -21437,12 +20388,6 @@ int main(int argc, char *argv[]) #undef main #define main K_and_R_C_main -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -21699,7 +20644,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) no_xml=yes fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" @@ -21732,12 +20677,6 @@ echo "${ECHO_T}no" >&6 #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -21913,12 +20852,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pam_get_data (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -22026,12 +20959,6 @@ extern "C" char $ac_func (); char (*f) (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -22097,12 +21024,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char crypt (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -22188,7 +21109,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) samba_cv_HAVE_TRUNCATED_SALT=yes fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi LIBS="$crypt_LIBS" fi @@ -22452,12 +21373,6 @@ else #include #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -22671,7 +21586,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_statvfs64=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statvfs64" >&5 @@ -22704,12 +21619,6 @@ else #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -22793,7 +21702,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_statfs3_osf1=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -22858,7 +21767,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_statfs2_bsize=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -22914,7 +21823,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_statfs4=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -22976,7 +21885,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_statfs2_fsize=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -23042,7 +21951,7 @@ cat conftest.$ac_ext >&5 ( exit $ac_status ) fu_cv_sys_stat_fs_data=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -23078,12 +21987,6 @@ cat >conftest.$ac_ext <<_ACEOF __COMPILE_ERROR_ #endif -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -23257,12 +22160,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char acl_get_file (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -23314,12 +22211,6 @@ else #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -23369,12 +22260,6 @@ else #include "confdefs.h" #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -23465,12 +22350,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -23517,12 +22396,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -23574,12 +22447,6 @@ else #undef _FILE_OFFSET_BITS #endif #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -23679,12 +22546,6 @@ else #include #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -23763,12 +22624,6 @@ else \ #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -23843,12 +22698,6 @@ else \ #include #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -23925,12 +22774,6 @@ else #include "confdefs.h" \ #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -24013,12 +22856,6 @@ else #include "confdefs.h" \ #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -24221,12 +23058,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -24279,12 +23110,6 @@ else #line $LINENO "configure" #include "confdefs.h" #include -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -24359,12 +23184,6 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char poptGetContext (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -24485,7 +23304,7 @@ cat conftest.$ac_ext >&5 echo "$as_me: error: summary failure. Aborting config" >&2;} { (exit 1); exit 1; }; }; exit 1; fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi builddir=`pwd` @@ -24494,7 +23313,7 @@ builddir=`pwd` # I added make files that are outside /source directory. # I know this is not a good solution, will work out a better # solution soon. --simo -ac_config_files="$ac_config_files include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/sam/Makefile" + ac_config_files="$ac_config_files include/stamp-h Makefile script/findsmb ../examples/sam/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -24505,7 +23324,7 @@ cat >confcache <<\_ACEOF # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # -# `ac_cv_env_foo' variables (set or unset) will be overriden when +# `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. @@ -24571,6 +23390,21 @@ fi DEFS=-DHAVE_CONFIG_H +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -24589,7 +23423,6 @@ SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF - ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -24598,11 +23431,13 @@ cat >>$CONFIG_STATUS <<\_ACEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi -# NLS nuisances. # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset @@ -24610,34 +23445,39 @@ else as_unset=false fi -(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && - { $as_unset LANG || test "${LANG+set}" != set; } || - { LANG=C; export LANG; } -(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && - { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || - { LC_ALL=C; export LC_ALL; } -(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && - { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || - { LC_TIME=C; export LC_TIME; } -(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && - { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || - { LC_CTYPE=C; export LC_CTYPE; } -(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && - { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || - { LANGUAGE=C; export LANGUAGE; } -(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && - { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || - { LC_COLLATE=C; export LC_COLLATE; } -(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && - { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || - { LC_NUMERIC=C; export LC_NUMERIC; } -(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && - { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || - { LC_MESSAGES=C; export LC_MESSAGES; } + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi # Name of the executable. -as_me=`(basename "$0") 2>/dev/null || +as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ @@ -24648,6 +23488,7 @@ echo X/"$0" | /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` + # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -24661,7 +23502,7 @@ if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh - if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: @@ -24715,6 +23556,8 @@ do as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} @@ -24788,6 +23631,12 @@ else fi rm -f conf$$ conf$$.exe conf$$.file +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. @@ -24804,7 +23653,7 @@ as_nl=' IFS=" $as_nl" # CDPATH. -$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } +$as_unset CDPATH exec 6>&1 @@ -24821,7 +23670,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by $as_me, which was -generated by GNU Autoconf 2.53. Invocation command line was +generated by GNU Autoconf 2.54. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -24880,7 +23729,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.53, +configured by $0, generated by GNU Autoconf 2.54, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 @@ -24901,17 +23750,20 @@ do --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - shift - set dummy "$ac_option" "$ac_optarg" ${1+"$@"} - shift + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift ;; - -*);; *) # This is not an option, so the user has probably given explicit # arguments. + ac_option=$1 ac_need_defaults=false;; esac - case $1 in + case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<_ACEOF @@ -24934,12 +23786,12 @@ Try \`$0 --help' for more information." >&2;} --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) - shift - CONFIG_FILES="$CONFIG_FILES $1" + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) - shift - CONFIG_HEADERS="$CONFIG_HEADERS $1" + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; # This is an error. @@ -24969,7 +23821,6 @@ do "include/stamp-h" ) CONFIG_FILES="$CONFIG_FILES include/stamp-h" ;; "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "script/findsmb" ) CONFIG_FILES="$CONFIG_FILES script/findsmb" ;; - "../examples/VFS/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../examples/VFS/Makefile" ;; "../examples/sam/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../examples/sam/Makefile" ;; "include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 @@ -25102,6 +23953,7 @@ s,@target_cpu@,$target_cpu,;t t s,@target_vendor@,$target_vendor,;t t s,@target_os@,$target_os,;t t s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t s,@CUPS_CONFIG@,$CUPS_CONFIG,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@TERMLIBS@,$TERMLIBS,;t t @@ -25126,6 +23978,7 @@ s,@BUILD_POPT@,$BUILD_POPT,;t t s,@FLAGS1@,$FLAGS1,;t t s,@PYTHON@,$PYTHON,;t t s,@builddir@,$builddir,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF @@ -25196,25 +24049,30 @@ echo X"$ac_file" | /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - { case "$ac_dir" in - [\\/]* | ?:[\\/]* ) as_incr_dir=;; - *) as_incr_dir=.;; -esac -as_dummy="$ac_dir" -for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do - case $as_mkdir_dir in - # Skip DOS drivespec - ?:) as_incr_dir=$as_mkdir_dir ;; - *) - as_incr_dir=$as_incr_dir/$as_mkdir_dir - test -d "$as_incr_dir" || - mkdir "$as_incr_dir" || - { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; } - ;; - esac -done; } + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } ac_builddir=. @@ -25244,7 +24102,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -25434,7 +24292,7 @@ _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail @@ -25458,7 +24316,7 @@ do mv conftest.tail conftest.defines done rm -f conftest.defines -echo ' fi # egrep' >>$CONFIG_STATUS +echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size @@ -25514,25 +24372,30 @@ echo X"$ac_file" | /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - { case "$ac_dir" in - [\\/]* | ?:[\\/]* ) as_incr_dir=;; - *) as_incr_dir=.;; -esac -as_dummy="$ac_dir" -for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do - case $as_mkdir_dir in - # Skip DOS drivespec - ?:) as_incr_dir=$as_mkdir_dir ;; - *) - as_incr_dir=$as_incr_dir/$as_mkdir_dir - test -d "$as_incr_dir" || - mkdir "$as_incr_dir" || - { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; } - ;; - esac -done; } + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file diff --git a/source3/configure.in b/source3/configure.in index 8e15da6fac7..3a01239dd1b 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -3174,7 +3174,7 @@ AC_SUBST(builddir) # I added make files that are outside /source directory. # I know this is not a good solution, will work out a better # solution soon. --simo -AC_OUTPUT(include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/sam/Makefile) +AC_OUTPUT(include/stamp-h Makefile script/findsmb ../examples/sam/Makefile) ################################################# # Print very concise instructions on building/use -- cgit From 1a03a47249e40c31c9bac7a28f3e7161673a4057 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 13:33:02 +0000 Subject: Only add modules/pdb_xml.so and modules/pdb_mysql.so to the 'modules' target if the libs they depend on are available (This used to be commit 018a44055d6a8435528279523567f9a86b2f3069) --- source3/Makefile.in | 2 +- source3/configure | 13 ++++++++----- source3/configure.in | 7 ++++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index a43ea93908f..8538bd56d6a 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -116,7 +116,7 @@ SCRIPTS = $(srcdir)/script/smbtar $(srcdir)/script/addtosmbpass $(srcdir)/script QUOTAOBJS=@QUOTAOBJS@ -MODULES = bin/vfs_audit.so bin/vfs_recycle.so bin/vfs_netatalk.so +MODULES = bin/vfs_audit.so bin/vfs_recycle.so bin/vfs_netatalk.so @MODULE_PDB_MYSQL@ @MODULE_PDB_XML@ ###################################################################### # object file lists diff --git a/source3/configure b/source3/configure index 8d160b87b35..964b3d5dba9 100755 --- a/source3/configure +++ b/source3/configure @@ -306,7 +306,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configdir lockdir piddir logfilebase privatedir swatdir RUNPROG MPROGS LDSHFLAGS SONAMEFLAG SHLD HOST_OS PAM_MOD WRAP WRAP32 WRAPPROG PICFLAG PICSUFFIX POBAD_CC SHLIBEXT LIBSMBCLIENT_SHARED LIBSMBCLIENT PRINTLIBS AUTHLIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK BROKEN_CC build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CPP EGREP CUPS_CONFIG LIBOBJS TERMLIBS TERMLDFLAGS ROFF DYNEXP MYSQL_CONFIG MYSQL_CFLAGS MYSQL_LIBS XML2_CONFIG XML_CFLAGS XML_LIBS QUOTAOBJS manlangs WINBIND_TARGETS WINBIND_STARGETS WINBIND_LTARGETS WINBIND_PAM_TARGETS WINBIND_NSS_EXTRA_OBJS WINBIND_NSS_EXTRA_LIBS BUILD_POPT FLAGS1 PYTHON builddir LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configdir lockdir piddir logfilebase privatedir swatdir RUNPROG MPROGS LDSHFLAGS SONAMEFLAG SHLD HOST_OS PAM_MOD WRAP WRAP32 WRAPPROG PICFLAG PICSUFFIX POBAD_CC SHLIBEXT LIBSMBCLIENT_SHARED LIBSMBCLIENT PRINTLIBS AUTHLIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK BROKEN_CC build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CPP EGREP CUPS_CONFIG LIBOBJS TERMLIBS TERMLDFLAGS ROFF DYNEXP MYSQL_CONFIG MYSQL_CFLAGS MYSQL_LIBS MODULE_PDB_MYSQL XML2_CONFIG XML_CFLAGS XML_LIBS MODULE_PDB_XML QUOTAOBJS manlangs WINBIND_TARGETS WINBIND_STARGETS WINBIND_LTARGETS WINBIND_PAM_TARGETS WINBIND_NSS_EXTRA_OBJS WINBIND_NSS_EXTRA_LIBS BUILD_POPT FLAGS1 PYTHON builddir LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -20360,7 +20360,7 @@ fi if test "x$no_mysql" = x ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - : + MODULE_PDB_MYSQL=bin/pdb_mysql.so else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 @@ -20432,7 +20432,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi MYSQL_CFLAGS="" MYSQL_LIBS="" - : + MODULE_PDB_MYSQL= fi @@ -20654,7 +20654,7 @@ fi if test "x$no_xml" = x ; then echo "$as_me:$LINENO: result: yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)" >&5 echo "${ECHO_T}yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)" >&6 - : + MODULE_PDB_XML=bin/pdb_xml.so else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 @@ -20722,7 +20722,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext XML_CFLAGS="" XML_LIBS="" - : + MODULE_PDB_XML= fi @@ -20730,6 +20730,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext CFLAGS="$CFLAGS $XML_CFLAGS" + ################################################# # check for automount support echo "$as_me:$LINENO: checking whether to use AUTOMOUNT" >&5 @@ -23963,9 +23964,11 @@ s,@DYNEXP@,$DYNEXP,;t t s,@MYSQL_CONFIG@,$MYSQL_CONFIG,;t t s,@MYSQL_CFLAGS@,$MYSQL_CFLAGS,;t t s,@MYSQL_LIBS@,$MYSQL_LIBS,;t t +s,@MODULE_PDB_MYSQL@,$MODULE_PDB_MYSQL,;t t s,@XML2_CONFIG@,$XML2_CONFIG,;t t s,@XML_CFLAGS@,$XML_CFLAGS,;t t s,@XML_LIBS@,$XML_LIBS,;t t +s,@MODULE_PDB_XML@,$MODULE_PDB_XML,;t t s,@QUOTAOBJS@,$QUOTAOBJS,;t t s,@manlangs@,$manlangs,;t t s,@WINBIND_TARGETS@,$WINBIND_TARGETS,;t t diff --git a/source3/configure.in b/source3/configure.in index 3a01239dd1b..7818f2f0c6e 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -2085,14 +2085,15 @@ fi ######################################################## # Compile with MySQL support? -AM_PATH_MYSQL() +AM_PATH_MYSQL([0.11.0],[MODULE_PDB_MYSQL=bin/pdb_mysql.so],[MODULE_PDB_MYSQL=]) CFLAGS="$CFLAGS $MYSQL_CFLAGS" - +AC_SUBST(MODULE_PDB_MYSQL) ######################################################## # Compile with XML support? -AM_PATH_XML2() +AM_PATH_XML2([2.0.0],[MODULE_PDB_XML=bin/pdb_xml.so],[MODULE_PDB_XML=]) CFLAGS="$CFLAGS $XML_CFLAGS" +AC_SUBST(MODULE_PDB_XML) ################################################# # check for automount support -- cgit From 5988d5e92a123d7c1b509ecafe8d14db47c01b30 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 13:47:12 +0000 Subject: Add a DEBUG() that gives the number of successfully loaded modules - useful for debugging (This used to be commit 612ea35ab016c56e6ad9886283901bc7b417337a) --- source3/lib/module.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/lib/module.c b/source3/lib/module.c index 2d8bd7459ff..5ad64858064 100644 --- a/source3/lib/module.c +++ b/source3/lib/module.c @@ -66,6 +66,8 @@ int smb_load_modules(const char **modules) } } + DEBUG(2, ("%d modules successfully loaded\n", success)); + return success; } -- cgit From 7fc28a91edc14fa9370280c18f046e42054969a0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 14:23:52 +0000 Subject: Ignore Makefile (This used to be commit 9c811e447821e9c934f9ecf841a38f7e1f7aa626) --- examples/VFS/.cvsignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/VFS/.cvsignore b/examples/VFS/.cvsignore index 0b0923a496a..92b494f978a 100644 --- a/examples/VFS/.cvsignore +++ b/examples/VFS/.cvsignore @@ -1,2 +1,4 @@ .libs *.so +*.o +Makefile -- cgit From aff957e7f740d81b3abde4b0c1faedda260a73b3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 14:45:11 +0000 Subject: Don't crash when there are no arguments specified (This used to be commit 0855e5810aefd71c37031be31abe91229e2de8b3) --- source3/utils/pdbedit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index 6a019e73d71..45a63c4b64c 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -495,7 +495,7 @@ int main (int argc, char **argv) poptGetArg(pc); /* Drop argv[0], the program name */ if (user_name == NULL) { - user_name = strdup(poptGetArg(pc)); + user_name = poptGetArg(pc); } if (!lp_load(dyn_CONFIGFILE,True,False,False)) { @@ -503,6 +503,9 @@ int main (int argc, char **argv) exit(1); } + if(lp_modules()) + smb_load_modules(lp_modules()); + if (!init_names()) exit(1); -- cgit From 994b3dbba2f35ddeac24b0d030eee02319b8ec40 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 14:51:50 +0000 Subject: add lp_modules() (This used to be commit 344d8e521f951e7f59b8378fee80bb553670a3be) --- source3/param/loadparm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 72831df070c..ff2fe48b604 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -111,6 +111,7 @@ typedef struct char *szPrivateDir; char **szPassdbBackend; char **szSamBackend; + char **szModules; char *szPasswordServer; char *szSocketOptions; char *szRealm; @@ -795,6 +796,7 @@ static struct parm_struct parm_table[] = { {"allow hosts", P_LIST, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, FLAG_HIDE}, {"hosts deny", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER}, {"deny hosts", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_HIDE}, + {"modules", P_LIST, P_GLOBAL, &Globals.szModules, NULL, NULL, FLAG_BASIC | FLAG_GLOBAL}, {"Logging Options", P_SEP, P_SEPARATOR}, @@ -1564,6 +1566,7 @@ static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion) FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases) FN_GLOBAL_LIST(lp_passdb_backend, &Globals.szPassdbBackend) FN_GLOBAL_LIST(lp_sam_backend, &Globals.szSamBackend) +FN_GLOBAL_LIST(lp_modules, &Globals.szModules) FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction) FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript) FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript) -- cgit From 2e2a5d50eb0fcbfdab14e56d6150a1bd35d57f28 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 15:34:49 +0000 Subject: Some more doc updates: - make - update status of docs document - move security_level to 'type of installation' part (This used to be commit 11ad39398e077c3901e63f31bcc6efb223854357) --- docs/docbook/projdoc/samba-doc.sgml | 22 +- docs/docbook/projdoc/security_level.sgml | 46 +- docs/docs-status | 5 +- docs/htmldocs/ads.html | 42 +- docs/htmldocs/appendixes.html | 391 ++++++++++++ docs/htmldocs/browsing-quick.html | 16 +- docs/htmldocs/bugreport.html | 30 +- docs/htmldocs/cvs-access.html | 22 +- docs/htmldocs/diagnosis.html | 66 +-- docs/htmldocs/domain-security.html | 24 +- docs/htmldocs/groupmapping.html | 6 +- docs/htmldocs/improved-browsing.html | 28 +- docs/htmldocs/install.html | 46 +- docs/htmldocs/integrate-ms-networks.html | 92 +-- docs/htmldocs/introduction.html | 438 ++++++++++++++ docs/htmldocs/msdfs.html | 14 +- docs/htmldocs/oplocks.html | 6 +- docs/htmldocs/optional.html | 955 ++++++++++++++++++++++++++++++ docs/htmldocs/other-clients.html | 58 +- docs/htmldocs/pam.html | 18 +- docs/htmldocs/pdb-mysql.html | 18 +- docs/htmldocs/pdb-xml.html | 18 +- docs/htmldocs/portability.html | 28 +- docs/htmldocs/printing.html | 104 ++-- docs/htmldocs/pwencrypt.html | 20 +- docs/htmldocs/samba-bdc.html | 38 +- docs/htmldocs/samba-howto-collection.html | 561 +++++++++--------- docs/htmldocs/samba-ldap-howto.html | 64 +- docs/htmldocs/samba-pdc.html | 100 ++-- docs/htmldocs/securitylevels.html | 92 +-- docs/htmldocs/speed.html | 92 +-- docs/htmldocs/type.html | 392 ++++++++++++ docs/htmldocs/unix-permissions.html | 42 +- docs/htmldocs/vfs.html | 403 +++++++++++++ docs/htmldocs/winbind.html | 70 +-- 35 files changed, 3446 insertions(+), 921 deletions(-) create mode 100644 docs/htmldocs/appendixes.html create mode 100644 docs/htmldocs/introduction.html create mode 100644 docs/htmldocs/optional.html create mode 100644 docs/htmldocs/type.html create mode 100644 docs/htmldocs/vfs.html diff --git a/docs/docbook/projdoc/samba-doc.sgml b/docs/docbook/projdoc/samba-doc.sgml index 52fb0e7bfa1..ce16405d54d 100644 --- a/docs/docbook/projdoc/samba-doc.sgml +++ b/docs/docbook/projdoc/samba-doc.sgml @@ -43,7 +43,7 @@ Abstract -Last Update : Thu Aug 15 12:48:45 CDT 2002 +Last Update : $Date: 2002/11/13 15:34:49 $ @@ -52,7 +52,8 @@ I try to ensure that all are current, but sometimes the is a larger job than one person can maintain. The most recent version of this document can be found at http://www.samba.org/ on the "Documentation" page. Please send updates to jerry@samba.org. +url="mailto:jerry@samba.org">jerry@samba.org or +jelmer@samba.org. @@ -69,7 +70,7 @@ Cheers, jerry - + General installation Introduction @@ -84,21 +85,23 @@ PLEASE read this. &ENCRYPTION; - + Type of installation Introduction -This part contains information on using samba in a (NT 4 or ADS) domain. -If you wish to run samba as a domain member or DC, read the appropriate chapter in -this part. + +Samba can operate in various SMB networks. This part contains information on configuring samba +for various environments. + +&SECURITY-LEVEL; &Samba-PDC-HOWTO; &Samba-BDC-HOWTO; &ADS-HOWTO; &DOMAIN-MEMBER; - + Optional configuration Introduction @@ -110,7 +113,6 @@ part each cover one specific feature. &Samba-PAM; &MS-Dfs-Setup; &PRINTER-DRIVER2; -&SECURITY-LEVEL; &WINBIND; &pdb-mysql; &pdb-xml; @@ -121,7 +123,7 @@ part each cover one specific feature. &SPEED; - + Appendixes &Portability; &Other-Clients; diff --git a/docs/docbook/projdoc/security_level.sgml b/docs/docbook/projdoc/security_level.sgml index 2f9a92d8723..e2d9cfbbaae 100644 --- a/docs/docbook/projdoc/security_level.sgml +++ b/docs/docbook/projdoc/security_level.sgml @@ -9,40 +9,7 @@ -Security levels - - -Introduction - - -Samba supports the following options to the global smb.conf parameter - - - -[global] -security = [share|user(default)|server|domain|ads] - - - -Please refer to the smb.conf man page for usage information and to the document -DOMAIN_MEMBER.html for further background details -on domain mode security. The Windows 2000 Kerberos domain security model -(security = ads) is described in the ADS-HOWTO.html. - - - -Of the above, "security = server" means that Samba reports to clients that -it is running in "user mode" but actually passes off all authentication -requests to another "user mode" server. This requires an additional -parameter "password server =" that points to the real authentication server. -That real authentication server can be another Samba server or can be a -Windows NT server, the later natively capable of encrypted password support. - - - - - -More complete description of security levels +User and Share security level (for servers not in a domain) A SMB server tells the client at startup what "security level" it is @@ -136,5 +103,14 @@ cryptographically impossible to translate from unix style encryption to SMB style encryption, although there are some fairly simple management schemes by which the two could be kept in sync. - + + +"security = server" means that Samba reports to clients that +it is running in "user mode" but actually passes off all authentication +requests to another "user mode" server. This requires an additional +parameter "password server =" that points to the real authentication server. +That real authentication server can be another Samba server or can be a +Windows NT server, the later natively capable of encrypted password support. + + diff --git a/docs/docs-status b/docs/docs-status index 9dfcd841d6f..23a0127c3b4 100644 --- a/docs/docs-status +++ b/docs/docs-status @@ -23,7 +23,6 @@ docs/docbook/projdoc/Samba-PDC-HOWTO.sgml - Needs update to 3.0 docs/docbook/projdoc/Speed.sgml - contains outdated and invalid information docs/docbook/projdoc/UNIX_INSTALL.sgml - Needs a lot of updating (swat, etc) docs/docbook/projdoc/printer_driver2.sgml - still up to date? -docs/docbook/projdoc/security_level.sgml - information about ads and domain should be added (currently only contains pointers to the ads and domain_member docs) docs/docbook/projdoc/winbind.sgml - needs documentation for ADS docs/textdocs/CUPS-PrintingInfo.txt - needs to be converted to sgml - Kurt Pfeifle docs/textdocs/PROFILES.txt - needs to be converted to sgml @@ -51,6 +50,8 @@ Merge the various docs about wins and browsing Windows NT 4.0 Style Trust Relationship One Time Migration script from a Windows NT 4.0 PDC to a Samba PDC ldap passwd sync -merge the various pdb docs +merge the various pdb docs and the doc about encryption +UNICODE support +Winbind with samba PDC http://www.unav.es/cti/ldap-smb/smb-ldap-3-howto.html diff --git a/docs/htmldocs/ads.html b/docs/htmldocs/ads.html index fc6b78b32c7..49345be2c08 100644 --- a/docs/htmldocs/ads.html +++ b/docs/htmldocs/ads.html @@ -11,7 +11,7 @@ TITLE="SAMBA Project Documentation" HREF="samba-howto-collection.html">Chapter 8. Samba as a ADS domain memberChapter 9. Samba as a ADS domain member

This is a VERY ROUGH guide to setting up the current (November 2001) pre-alpha version of Samba 3.0 with kerberos authentication against a @@ -113,9 +113,9 @@ CLASS="SECT1" >

8.1. Installing the required packages for Debian

9.1. Installing the required packages for Debian

On Debian you need to install the following packages:

8.2. Installing the required packages for RedHat

9.2. Installing the required packages for RedHat

On RedHat this means you should have at least:

8.3. Compile Samba

9.3. Compile Samba

If your kerberos libraries are in a non-standard location then remember to add the configure option --with-krb5=DIR.

8.4. Setup your /etc/krb5.conf

9.4. Setup your /etc/krb5.conf

The minimal configuration for krb5.conf is:

8.5. Create the computer account

9.5. Create the computer account

Do a "kinit" as a user that has authority to change arbitrary passwords on the KDC ("Administrator" is a good choice). Then as a @@ -281,9 +281,9 @@ CLASS="SECT2" >

8.5.1. Possible errors

9.5.1. Possible errors

8.6. Test your server setup

9.6. Test your server setup

On a Windows 2000 client try

8.7. Testing with smbclient

9.7. Testing with smbclient

On your Samba server try to login to a Win2000 server or your Samba server using smbclient and kerberos. Use smbclient as usual, but @@ -345,9 +345,9 @@ CLASS="SECT1" >

8.8. Notes

9.8. Notes

You must change administrator password at least once after DC install, to create the right encoding types

Up +Appendixes
SAMBA Project Documentation
PrevNext

IV. Appendixes

Table of Contents
24. Portability
24.1. HPUX
24.2. SCO Unix
24.3. DNIX
24.4. RedHat Linux Rembrandt-II
25. Samba and other CIFS clients
25.1. Macintosh clients?
25.2. OS2 Client
25.2.1. How can I configure OS/2 Warp Connect or + OS/2 Warp 4 as a client for Samba?
25.2.2. How can I configure OS/2 Warp 3 (not Connect), + OS/2 1.2, 1.3 or 2.x for Samba?
25.2.3. Are there any other issues when OS/2 (any version) + is used as a client?
25.2.4. How do I get printer driver download working + for OS/2 clients?
25.3. Windows for Workgroups
25.3.1. Use latest TCP/IP stack from Microsoft
25.3.2. Delete .pwl files after password change
25.3.3. Configure WfW password handling
25.3.4. Case handling of passwords
25.4. Windows '95/'98
25.5. Windows 2000 Service Pack 2
26. Reporting Bugs
26.1. Introduction
26.2. General info
26.3. Debug levels
26.4. Internal errors
26.5. Attaching to a running process
26.6. Patches
27. Diagnosing your samba server
27.1. Introduction
27.2. Assumptions
27.3. Tests
27.3.1. Test 1
27.3.2. Test 2
27.3.3. Test 3
27.3.4. Test 4
27.3.5. Test 5
27.3.6. Test 6
27.3.7. Test 7
27.3.8. Test 8
27.3.9. Test 9
27.3.10. Test 10
27.3.11. Test 11
27.4. Still having troubles?

PrevHomeNext
Samba performance issues Portability
\ No newline at end of file diff --git a/docs/htmldocs/browsing-quick.html b/docs/htmldocs/browsing-quick.html index d2546f74b22..cc703d217f5 100644 --- a/docs/htmldocs/browsing-quick.html +++ b/docs/htmldocs/browsing-quick.html @@ -11,7 +11,7 @@ TITLE="SAMBA Project Documentation" HREF="samba-howto-collection.html">

4.1. Discussion

4.2. Use of the "Remote Announce" parameter

4.3. Use of the "Remote Browse Sync" parameter

4.4. Use of WINS

4.5. Do NOT use more than one (1) protocol on MS Windows machines

4.6. Name Resolution Order

UpChapter 25. Reporting BugsChapter 26. Reporting Bugs

25.1. Introduction

26.1. Introduction

The email address for bug reports for stable releases is

25.2. General info

26.2. General info

Before submitting a bug report check your config for silly errors. Look in your log files for obvious messages that tell you that @@ -150,9 +150,9 @@ CLASS="SECT1" >

25.3. Debug levels

26.3. Debug levels

If the bug has anything to do with Samba behaving incorrectly as a server (like refusing to open a file) then the log files will probably @@ -220,9 +220,9 @@ CLASS="SECT1" >

25.4. Internal errors

26.4. Internal errors

If you get a "INTERNAL ERROR" message in your log files it means that Samba got an unexpected signal while running. It is probably a @@ -264,9 +264,9 @@ CLASS="SECT1" >

25.5. Attaching to a running process

26.5. Attaching to a running process

Unfortunately some unixes (in particular some recent linux kernels) refuse to dump a core file if the task has changed uid (which smbd @@ -281,9 +281,9 @@ CLASS="SECT1" >

25.6. Patches

26.6. Patches

The best sort of bug report is one that includes a fix! If you send us patches please use UpChapter 20. HOWTO Access Samba source code via CVSChapter 21. HOWTO Access Samba source code via CVS

20.1. Introduction

21.1. Introduction

Samba is developed in an open environment. Developers use CVS (Concurrent Versioning System) to "checkin" (also known as @@ -102,9 +102,9 @@ CLASS="SECT1" >

20.2. CVS Access to samba.org

21.2. CVS Access to samba.org

The machine samba.org runs a publicly accessible CVS repository for access to the source code of several packages, @@ -115,9 +115,9 @@ CLASS="SECT2" >

20.2.1. Access via CVSweb

21.2.1. Access via CVSweb

You can access the source code via your favourite WWW browser. This allows you to access the contents of @@ -136,9 +136,9 @@ CLASS="SECT2" >

20.2.2. Access via cvs

21.2.2. Access via cvs

You can also access the source code via a normal cvs client. This gives you much more control over you can @@ -290,7 +290,7 @@ WIDTH="34%" ALIGN="center" VALIGN="top" >UpChapter 26. Diagnosing your samba serverChapter 27. Diagnosing your samba server

26.1. Introduction

27.1. Introduction

This file contains a list of tests you can perform to validate your Samba server. It also tells you what the likely cause of the problem @@ -95,9 +95,9 @@ CLASS="SECT1" >

26.2. Assumptions

27.2. Assumptions

In all of the tests it is assumed you have a Samba server called BIGSERVER and a PC called ACLIENT both in workgroup TESTGROUP.

26.3. Tests

27.3. Tests

26.3.1. Test 1

27.3.1. Test 1

In the directory in which you store your smb.conf file, run the command "testparm smb.conf". If it reports any errors then your smb.conf @@ -163,9 +163,9 @@ CLASS="SECT2" >

26.3.2. Test 2

27.3.2. Test 2

Run the command "ping BIGSERVER" from the PC and "ping ACLIENT" from the unix box. If you don't get a valid response then your TCP/IP @@ -189,9 +189,9 @@ CLASS="SECT2" >

26.3.3. Test 3

27.3.3. Test 3

Run the command "smbclient -L BIGSERVER" on the unix box. You should get a list of available shares back.

26.3.4. Test 4

27.3.4. Test 4

Run the command "nmblookup -B BIGSERVER __SAMBA__". You should get the IP address of your Samba server back.

26.3.5. Test 5

27.3.5. Test 5

run the command

26.3.6. Test 6

27.3.6. Test 6

Run the command

26.3.7. Test 7

27.3.7. Test 7

Run the command

26.3.8. Test 8

27.3.8. Test 8

On the PC type the command

26.3.9. Test 9

27.3.9. Test 9

Run the command

26.3.10. Test 10

27.3.10. Test 10

Run the command

26.3.11. Test 11

27.3.11. Test 11

From file manager try to browse the server. Your samba server should appear in the browse list of your local workgroup (or the one you @@ -573,9 +573,9 @@ CLASS="SECT1" >

26.4. Still having troubles?

27.4. Still having troubles?

Try the mailing list or newsgroup, or use the ethereal utility to sniff the problem. The official samba mailing list can be reached at @@ -641,7 +641,7 @@ WIDTH="34%" ALIGN="center" VALIGN="top" >UpNextChapter 9. Samba as a NT4 domain memberChapter 10. Samba as a NT4 domain member

9.1. Joining an NT Domain with Samba 2.2

10.1. Joining an NT Domain with Samba 2.2

Assume you have a Samba 2.x server with a NetBIOS name of

9.2. Samba and Windows 2000 Domains

10.2. Samba and Windows 2000 Domains

Many people have asked regarding the state of Samba's ability to participate in a Windows 2000 Domain. Samba 3.0 is able to act as a member server of a Windows @@ -336,9 +336,9 @@ CLASS="SECT1" >

9.3. Why is this better than security = server?

10.3. Why is this better than security = server?

Currently, domain security in Samba doesn't free you from having to create local Unix users to represent the users attaching @@ -456,7 +456,7 @@ WIDTH="33%" ALIGN="right" VALIGN="top" >NextUpChapter 21. Group mapping HOWTOChapter 22. Group mapping HOWTO

Starting with Samba 3.0 alpha 2, a new group mapping function is available. The @@ -219,7 +219,7 @@ WIDTH="34%" ALIGN="center" VALIGN="top" >Up

2.1. Overview of browsing

2.2. Browsing support in samba

2.3. Problem resolution

2.4. Browsing across subnets

2.4.1. How does cross subnet browsing work ?

2.5. Setting up a WINS server

2.6. Setting up Browsing in a WORKGROUP

2.7. Setting up Browsing in a DOMAIN

2.8. Forcing samba to be the master

2.9. Making samba the domain master

2.10. Note about broadcast addresses

2.11. Multiple interfaces

UpPrev

1.1. Read the man pages

1.2. Building the Binaries

1.3. The all important step

1.4. Create the smb configuration file.

1.5. Test your config file with

1.6. Starting the smbd and nmbd

1.6.1. Starting from inetd.conf

1.6.2. Alternative: starting it as a daemon

1.7. Try listing the shares available on your server

1.8. Try connecting with the unix client

1.9. Try connecting from a DOS, WfWg, Win9x, WinNT, Win2k, OS/2, etc... client

1.10. What If Things Don't Work?

1.10.1. Diagnosing Problems

1.10.2. Scope IDs

1.10.3. Choosing the Protocol Level

1.10.4. Printing from UNIX to a Client PC

1.10.5. Locking

1.10.6. Mapping Usernames

PrevUpPrevChapter 10. Integrating MS Windows networks with Samba

Chapter 11. Integrating MS Windows networks with Samba

10.1. Agenda

11.1. Agenda

To identify the key functional mechanisms of MS Windows networking to enable the deployment of Samba as a means of extending and/or @@ -147,9 +147,9 @@ CLASS="SECT1" >

10.2. Name Resolution in a pure Unix/Linux world

11.2. Name Resolution in a pure Unix/Linux world

The key configuration files covered in this section are:

10.2.1. 11.2.1. /etc/hosts

10.2.2. 11.2.2. /etc/resolv.conf

10.2.3. 11.2.3. /etc/host.conf

10.2.4. 11.2.4. /etc/nsswitch.conf

10.3. Name resolution as used within MS Windows networking

11.3. Name resolution as used within MS Windows networking

MS Windows networking is predicated about the name each machine is given. This name is known variously (and inconsistently) as @@ -491,9 +491,9 @@ CLASS="SECT2" >

10.3.1. The NetBIOS Name Cache

11.3.1. The NetBIOS Name Cache

All MS Windows machines employ an in memory buffer in which is stored the NetBIOS names and IP addresses for all external @@ -518,9 +518,9 @@ CLASS="SECT2" >

10.3.2. The LMHOSTS file

11.3.2. The LMHOSTS file

This file is usually located in MS Windows NT 4.0 or 2000 in

10.3.3. HOSTS file

11.3.3. HOSTS file

This file is usually located in MS Windows NT 4.0 or 2000 in

10.3.4. DNS Lookup

11.3.4. DNS Lookup

This capability is configured in the TCP/IP setup area in the network configuration facility. If enabled an elaborate name resolution sequence @@ -663,9 +663,9 @@ CLASS="SECT2" >

10.3.5. WINS Lookup

11.3.5. WINS Lookup

A WINS (Windows Internet Name Server) service is the equivaent of the rfc1001/1002 specified NBNS (NetBIOS Name Server). A WINS server stores @@ -706,9 +706,9 @@ CLASS="SECT1" >

10.4. How browsing functions and how to deploy stable and +>11.4. How browsing functions and how to deploy stable and dependable browsing using Samba

As stated above, MS Windows machines register their NetBIOS names @@ -773,9 +773,9 @@ CLASS="SECT1" >

10.5. MS Windows security options and how to configure +>11.5. MS Windows security options and how to configure Samba for seemless integration

MS Windows clients may use encrypted passwords as part of a @@ -910,9 +910,9 @@ CLASS="SECT2" >

10.5.1. Use MS Windows NT as an authentication server

11.5.1. Use MS Windows NT as an authentication server

This method involves the additions of the following parameters in the smb.conf file:

10.5.2. Make Samba a member of an MS Windows NT security domain

11.5.2. Make Samba a member of an MS Windows NT security domain

This method involves additon of the following paramters in the smb.conf file:

10.5.3. Configure Samba as an authentication server

11.5.3. Configure Samba as an authentication server

This mode of authentication demands that there be on the Unix/Linux system both a Unix style account as well as an @@ -1046,9 +1046,9 @@ CLASS="SECT3" >

10.5.3.1. Users

11.5.3.1. Users

A user account that may provide a home directory should be created. The following Linux system commands are typical of @@ -1069,9 +1069,9 @@ CLASS="SECT3" >

10.5.3.2. MS Windows NT Machine Accounts

11.5.3.2. MS Windows NT Machine Accounts

These are required only when Samba is used as a domain controller. Refer to the Samba-PDC-HOWTO for more details.

10.6. Conclusions

11.6. Conclusions

Samba provides a flexible means to operate as...

PrevUp +General installation

SAMBA Project Documentation
PrevNext

I. General installation

Introduction

This part contains general info on how to install samba +and how to configure the parts of samba you will most likely need. +PLEASE read this.

Table of Contents
1. How to Install and Test SAMBA
1.1. Read the man pages
1.2. Building the Binaries
1.3. The all important step
1.4. Create the smb configuration file.
1.5. Test your config file with + testparm
1.6. Starting the smbd and nmbd
1.6.1. Starting from inetd.conf
1.6.2. Alternative: starting it as a daemon
1.7. Try listing the shares available on your + server
1.8. Try connecting with the unix client
1.9. Try connecting from a DOS, WfWg, Win9x, WinNT, + Win2k, OS/2, etc... client
1.10. What If Things Don't Work?
1.10.1. Diagnosing Problems
1.10.2. Scope IDs
1.10.3. Choosing the Protocol Level
1.10.4. Printing from UNIX to a Client PC
1.10.5. Locking
1.10.6. Mapping Usernames
2. Improved browsing in samba
2.1. Overview of browsing
2.2. Browsing support in samba
2.3. Problem resolution
2.4. Browsing across subnets
2.4.1. How does cross subnet browsing work ?
2.5. Setting up a WINS server
2.6. Setting up Browsing in a WORKGROUP
2.7. Setting up Browsing in a DOMAIN
2.8. Forcing samba to be the master
2.9. Making samba the domain master
2.10. Note about broadcast addresses
2.11. Multiple interfaces
3. Oplocks
3.1. What are oplocks?
4. Quick Cross Subnet Browsing / Cross Workgroup Browsing guide
4.1. Discussion
4.2. Use of the "Remote Announce" parameter
4.3. Use of the "Remote Browse Sync" parameter
4.4. Use of WINS
4.5. Do NOT use more than one (1) protocol on MS Windows machines
4.6. Name Resolution Order
5. LanMan and NT Password Encryption in Samba
5.1. Introduction
5.2. Important Notes About Security
5.2.1. Advantages of SMB Encryption
5.2.2. Advantages of non-encrypted passwords
5.3. The smbpasswd Command

PrevHomeNext
SAMBA Project Documentation How to Install and Test SAMBA
\ No newline at end of file diff --git a/docs/htmldocs/msdfs.html b/docs/htmldocs/msdfs.html index 95902f72173..832187d19f2 100644 --- a/docs/htmldocs/msdfs.html +++ b/docs/htmldocs/msdfs.html @@ -11,7 +11,7 @@ TITLE="SAMBA Project Documentation" HREF="samba-howto-collection.html">Chapter 13. Hosting a Microsoft Distributed File System tree on SambaChapter 14. Hosting a Microsoft Distributed File System tree on Samba

13.1. Instructions

14.1. Instructions

The Distributed File System (or Dfs) provides a means of separating the logical view of files and directories that users @@ -229,9 +229,9 @@ CLASS="SECT2" >

13.1.1. Notes

14.1.1. Notes

    Up

    3.1. What are oplocks?

    Up +Optional configuration

    SAMBA Project Documentation
    PrevNext

    III. Optional configuration

    Introduction

    Samba has several features that you might want or might not want to use. The chapters in this +part each cover one specific feature.

    Table of Contents
    11. Integrating MS Windows networks with Samba
    11.1. Agenda
    11.2. Name Resolution in a pure Unix/Linux world
    11.2.1. /etc/hosts
    11.2.2. /etc/resolv.conf
    11.2.3. /etc/host.conf
    11.2.4. /etc/nsswitch.conf
    11.3. Name resolution as used within MS Windows networking
    11.3.1. The NetBIOS Name Cache
    11.3.2. The LMHOSTS file
    11.3.3. HOSTS file
    11.3.4. DNS Lookup
    11.3.5. WINS Lookup
    11.4. How browsing functions and how to deploy stable and +dependable browsing using Samba
    11.5. MS Windows security options and how to configure +Samba for seemless integration
    11.5.1. Use MS Windows NT as an authentication server
    11.5.2. Make Samba a member of an MS Windows NT security domain
    11.5.3. Configure Samba as an authentication server
    11.6. Conclusions
    12. UNIX Permission Bits and Windows NT Access Control Lists
    12.1. Viewing and changing UNIX permissions using the NT + security dialogs
    12.2. How to view file security on a Samba share
    12.3. Viewing file ownership
    12.4. Viewing file or directory permissions
    12.4.1. File Permissions
    12.4.2. Directory Permissions
    12.5. Modifying file or directory permissions
    12.6. Interaction with the standard Samba create mask + parameters
    12.7. Interaction with the standard Samba file attribute + mapping
    13. Configuring PAM for distributed but centrally +managed authentication
    13.1. Samba and PAM
    13.2. Distributed Authentication
    13.3. PAM Configuration in smb.conf
    14. Hosting a Microsoft Distributed File System tree on Samba
    14.1. Instructions
    14.1.1. Notes
    15. Printing Support
    15.1. Introduction
    15.2. Configuration
    15.2.1. Creating [print$]
    15.2.2. Setting Drivers for Existing Printers
    15.2.3. Support a large number of printers
    15.2.4. Adding New Printers via the Windows NT APW
    15.2.5. Samba and Printer Ports
    15.3. The Imprints Toolset
    15.3.1. What is Imprints?
    15.3.2. Creating Printer Driver Packages
    15.3.3. The Imprints server
    15.3.4. The Installation Client
    15.4. Diagnosis
    15.4.1. Introduction
    15.4.2. Debugging printer problems
    15.4.3. What printers do I have?
    15.4.4. Setting up printcap and print servers
    15.4.5. Job sent, no output
    15.4.6. Job sent, strange output
    15.4.7. Raw PostScript printed
    15.4.8. Advanced Printing
    15.4.9. Real debugging
    16. Unified Logons between Windows NT and UNIX using Winbind
    16.1. Abstract
    16.2. Introduction
    16.3. What Winbind Provides
    16.3.1. Target Uses
    16.4. How Winbind Works
    16.4.1. Microsoft Remote Procedure Calls
    16.4.2. Name Service Switch
    16.4.3. Pluggable Authentication Modules
    16.4.4. User and Group ID Allocation
    16.4.5. Result Caching
    16.5. Installation and Configuration
    16.5.1. Introduction
    16.5.2. Requirements
    16.5.3. Testing Things Out
    16.6. Limitations
    16.7. Conclusion
    17. Passdb MySQL plugin
    17.1. Building
    17.2. Configuring
    17.3. Using plaintext passwords or encrypted password
    17.4. Getting non-column data from the table
    18. Passdb XML plugin
    18.1. Building
    18.2. Usage
    19. Stackable VFS modules
    19.1. Introduction and configuration
    19.2. Included modules
    19.2.1. audit
    19.2.2. recycle
    19.2.3. netatalk
    19.3. VFS modules available elsewhere
    19.3.1. DatabaseFS
    19.3.2. vscan
    20. Storing Samba's User/Machine Account information in an LDAP Directory
    20.1. Purpose
    20.2. Introduction
    20.3. Supported LDAP Servers
    20.4. Schema and Relationship to the RFC 2307 posixAccount
    20.5. Configuring Samba with LDAP
    20.5.1. OpenLDAP configuration
    20.5.2. Configuring Samba
    20.6. Accounts and Groups management
    20.7. Security and sambaAccount
    20.8. LDAP specials attributes for sambaAccounts
    20.9. Example LDIF Entries for a sambaAccount
    20.10. Comments
    21. HOWTO Access Samba source code via CVS
    21.1. Introduction
    21.2. CVS Access to samba.org
    21.2.1. Access via CVSweb
    21.2.2. Access via cvs
    22. Group mapping HOWTO
    23. Samba performance issues
    23.1. Comparisons
    23.2. Oplocks
    23.2.1. Overview
    23.2.2. Level2 Oplocks
    23.2.3. Old 'fake oplocks' option - deprecated
    23.3. Socket options
    23.4. Read size
    23.5. Max xmit
    23.6. Locking
    23.7. Share modes
    23.8. Log level
    23.9. Wide lines
    23.10. Read raw
    23.11. Write raw
    23.12. Read prediction
    23.13. Memory mapping
    23.14. Slow Clients
    23.15. Slow Logins
    23.16. Client tuning
    23.17. My Results

    PrevHomeNext
    Samba as a NT4 domain member Integrating MS Windows networks with Samba
    \ No newline at end of file diff --git a/docs/htmldocs/other-clients.html b/docs/htmldocs/other-clients.html index 38dfc04a64a..892509a591e 100644 --- a/docs/htmldocs/other-clients.html +++ b/docs/htmldocs/other-clients.html @@ -11,7 +11,7 @@ TITLE="SAMBA Project Documentation" HREF="samba-howto-collection.html">Chapter 24. Samba and other CIFS clientsChapter 25. Samba and other CIFS clients

    This chapter contains client-specific information.

    24.1. Macintosh clients?

    25.1. Macintosh clients?

    Yes.

    24.2. OS2 Client

    25.2. OS2 Client

    24.2.1. How can I configure OS/2 Warp Connect or +>25.2.1. How can I configure OS/2 Warp Connect or OS/2 Warp 4 as a client for Samba?

    A more complete answer to this question can be @@ -195,9 +195,9 @@ CLASS="SECT2" >

    24.2.2. How can I configure OS/2 Warp 3 (not Connect), +>25.2.2. How can I configure OS/2 Warp 3 (not Connect), OS/2 1.2, 1.3 or 2.x for Samba?

    You can use the free Microsoft LAN Manager 2.2c Client @@ -239,9 +239,9 @@ CLASS="SECT2" >

    24.2.3. Are there any other issues when OS/2 (any version) +>25.2.3. Are there any other issues when OS/2 (any version) is used as a client?

    When you do a NET VIEW or use the "File and Print @@ -261,9 +261,9 @@ CLASS="SECT2" >

    24.2.4. How do I get printer driver download working +>25.2.4. How do I get printer driver download working for OS/2 clients?

    First, create a share called [PRINTDRV] that is @@ -312,17 +312,17 @@ CLASS="SECT1" >

    24.3. Windows for Workgroups

    25.3. Windows for Workgroups

    24.3.1. Use latest TCP/IP stack from Microsoft

    25.3.1. Use latest TCP/IP stack from Microsoft

    Use the latest TCP/IP stack from microsoft if you use Windows for workgroups.

    24.3.2. Delete .pwl files after password change

    25.3.2. Delete .pwl files after password change

    WfWg does a lousy job with passwords. I find that if I change my password on either the unix box or the PC the safest thing to do is to @@ -362,9 +362,9 @@ CLASS="SECT2" >

    24.3.3. Configure WfW password handling

    25.3.3. Configure WfW password handling

    There is a program call admincfg.exe on the last disk (disk 8) of the WFW 3.11 disk set. To install it @@ -381,9 +381,9 @@ CLASS="SECT2" >

    24.3.4. Case handling of passwords

    25.3.4. Case handling of passwords

    Windows for Workgroups uppercases the password before sending it to the server. Unix passwords can be case-sensitive though. Check the

    24.4. Windows '95/'98

    25.4. Windows '95/'98

    When using Windows 95 OEM SR2 the following updates are recommended where Samba is being used. Please NOTE that the above change will affect you once these @@ -448,9 +448,9 @@ CLASS="SECT1" >

    24.5. Windows 2000 Service Pack 2

    25.5. Windows 2000 Service Pack 2

    There are several annoyances with Windows 2000 SP2. One of which @@ -576,7 +576,7 @@ WIDTH="34%" ALIGN="center" VALIGN="top" >UpChapter 12. Configuring PAM for distributed but centrally +>Chapter 13. Configuring PAM for distributed but centrally managed authentication

    12.1. Samba and PAM

    13.1. Samba and PAM

    A number of Unix systems (eg: Sun Solaris), as well as the xxxxBSD family and Linux, now utilize the Pluggable Authentication @@ -296,9 +296,9 @@ CLASS="SECT1" >

    12.2. Distributed Authentication

    13.2. Distributed Authentication

    The astute administrator will realize from this that the combination of

    12.3. PAM Configuration in smb.conf

    13.3. PAM Configuration in smb.conf

    There is an option in smb.conf called Up

    17.1. Building

    17.2. Configuring

    17.3. Using plaintext passwords or encrypted password

    I strongly discourage the use of plaintext passwords, however, you can use them:

    If you would like to use plaintext passwords, set 'identifier:lanman pass column' and 'identifier:nt pass column' to 'NULL' (without the quotes) and 'identifier:plaintext pass column' to the name of the column containing the plaintext passwords.

    If you would like to use plaintext passwords, set 'identifier:lanman pass column' and 'identifier:nt pass column' to 'NULL' (without the quotes) and 'identifier:plain pass column' to the name of the column containing the plaintext passwords.

    If you use encrypted passwords, set the 'identifier:plaintext pass column' to 'NULL' (without the quotes). This is the default.

    If you use encrypted passwords, set the 'identifier:plain pass column' to 'NULL' (without the quotes). This is the default.

    17.4. Getting non-column data from the table

    UpNext

    18.1. Building

    18.2. Usage

    NextUpStoring Samba's User/Machine Account information in an LDAP DirectoryStackable VFS modules

    PrevChapter 23. PortabilityChapter 24. Portability

    Samba works on a wide range of platforms but the interface all the platforms provide is not always compatible. This chapter contains @@ -84,9 +84,9 @@ CLASS="SECT1" >

    23.1. HPUX

    24.1. HPUX

    HP's implementation of supplementary groups is, er, non-standard (for hysterical reasons). There are two group files, /etc/group and @@ -114,9 +114,9 @@ CLASS="SECT1" >

    23.2. SCO Unix

    24.2. SCO Unix

    If you run an old version of SCO Unix then you may need to get important @@ -131,9 +131,9 @@ CLASS="SECT1" >

    23.3. DNIX

    24.3. DNIX

    DNIX has a problem with seteuid() and setegid(). These routines are needed for Samba to work correctly, but they were left out of the DNIX @@ -238,9 +238,9 @@ CLASS="SECT1" >

    23.4. RedHat Linux Rembrandt-II

    24.4. RedHat Linux Rembrandt-II

    By default RedHat Rembrandt-II during installation adds an entry to /etc/hosts as follows: @@ -274,7 +274,7 @@ WIDTH="33%" ALIGN="left" VALIGN="top" >PrevUpNextChapter 14. Printing SupportChapter 15. Printing Support

    14.1. Introduction

    15.1. Introduction

    Beginning with the 2.2.0 release, Samba supports the native Windows NT printing mechanisms implemented via @@ -163,9 +163,9 @@ CLASS="SECT1" >

    14.2. Configuration

    15.2. Configuration

    14.2.1. Creating [print$]

    15.2.1. Creating [print$]

    In order to support the uploading of printer driver files, you must first configure a file share named [print$]. @@ -452,9 +452,9 @@ CLASS="SECT2" >

    14.2.2. Setting Drivers for Existing Printers

    15.2.2. Setting Drivers for Existing Printers

    The initial listing of printers in the Samba host's Printers folder will have no real printer driver assigned @@ -524,9 +524,9 @@ CLASS="SECT2" >

    14.2.3. Support a large number of printers

    15.2.3. Support a large number of printers

    One issue that has arisen during the development phase of Samba 2.2 is the need to support driver downloads for @@ -590,9 +590,9 @@ CLASS="SECT2" >

    14.2.4. Adding New Printers via the Windows NT APW

    15.2.4. Adding New Printers via the Windows NT APW

    By default, Samba offers all printer shares defined in

    14.2.5. Samba and Printer Ports

    15.2.5. Samba and Printer Ports

    Windows NT/2000 print servers associate a port with each printer. These normally take the form of LPT1:, COM1:, FILE:, etc... Samba must also support the @@ -796,9 +796,9 @@ CLASS="SECT1" >

    14.3. The Imprints Toolset

    15.3. The Imprints Toolset

    The Imprints tool set provides a UNIX equivalent of the Windows NT Add Printer Wizard. For complete information, please @@ -814,9 +814,9 @@ CLASS="SECT2" >

    14.3.1. What is Imprints?

    15.3.1. What is Imprints?

    Imprints is a collection of tools for supporting the goals of

    14.3.2. Creating Printer Driver Packages

    15.3.2. Creating Printer Driver Packages

    The process of creating printer driver packages is beyond the scope of this document (refer to Imprints.txt also included @@ -862,9 +862,9 @@ CLASS="SECT2" >

    14.3.3. The Imprints server

    15.3.3. The Imprints server

    The Imprints server is really a database server that may be queried via standard HTTP mechanisms. Each printer @@ -886,9 +886,9 @@ CLASS="SECT2" >

    14.3.4. The Installation Client

    15.3.4. The Installation Client

    More information regarding the Imprints installation client is available in the

    14.4. Diagnosis

    15.4. Diagnosis

    14.4.1. Introduction

    15.4.1. Introduction

    This is a short description of how to debug printing problems with Samba. This describes how to debug problems with printing from a SMB @@ -1063,9 +1063,9 @@ CLASS="SECT2" >

    14.4.2. Debugging printer problems

    15.4.2. Debugging printer problems

    One way to debug printing problems is to start by replacing these command with shell scripts that record the arguments and the contents @@ -1120,9 +1120,9 @@ CLASS="SECT2" >

    14.4.3. What printers do I have?

    15.4.3. What printers do I have?

    You can use the 'testprns' program to check to see if the printer name you are using is recognized by Samba. For example, you can @@ -1149,9 +1149,9 @@ CLASS="SECT2" >

    14.4.4. Setting up printcap and print servers

    15.4.4. Setting up printcap and print servers

    You may need to set up some printcaps for your Samba system to use. It is strongly recommended that you use the facilities provided by @@ -1233,9 +1233,9 @@ CLASS="SECT2" >

    14.4.5. Job sent, no output

    15.4.5. Job sent, no output

    This is the most frustrating part of printing. You may have sent the job, verified that the job was forwarded, set up a wrapper around @@ -1278,9 +1278,9 @@ CLASS="SECT2" >

    14.4.6. Job sent, strange output

    15.4.6. Job sent, strange output

    Once you have the job printing, you can then start worrying about making it print nicely.

    14.4.7. Raw PostScript printed

    15.4.7. Raw PostScript printed

    This is a problem that is usually caused by either the print spooling system putting information at the start of the print job that makes @@ -1339,9 +1339,9 @@ CLASS="SECT2" >

    14.4.8. Advanced Printing

    15.4.8. Advanced Printing

    Note that you can do some pretty magic things by using your imagination with the "print command" option and some shell scripts. @@ -1355,9 +1355,9 @@ CLASS="SECT2" >

    14.4.9. Real debugging

    15.4.9. Real debugging

    If the above debug tips don't help, then maybe you need to bring in the bug guns, system tracing. See Tracing.txt in this directory.

    NextUpSecurity levelsUnified Logons between Windows NT and UNIX using Winbind
    Next

    5.1. Introduction

    5.2. Important Notes About Security

    5.2.1. Advantages of SMB Encryption

    5.2.2. Advantages of non-encrypted passwords

    5.3. The smbpasswd Command

    NextUpChapter 7. How to Act as a Backup Domain Controller in a Purely Samba Controlled DomainChapter 8. How to Act as a Backup Domain Controller in a Purely Samba Controlled Domain

    7.1. Prerequisite Reading

    8.1. Prerequisite Reading

    Before you continue reading in this chapter, please make sure that you are comfortable with configuring a Samba PDC @@ -97,9 +97,9 @@ CLASS="SECT1" >

    7.2. Background

    8.2. Background

    What is a Domain Controller? It is a machine that is able to answer logon requests from workstations in a Windows NT Domain. Whenever a @@ -142,9 +142,9 @@ CLASS="SECT1" >

    7.3. What qualifies a Domain Controller on the network?

    8.3. What qualifies a Domain Controller on the network?

    Every machine that is a Domain Controller for the domain SAMBA has to register the NetBIOS group name SAMBA#1c with the WINS server and/or @@ -159,9 +159,9 @@ CLASS="SECT2" >

    7.3.1. How does a Workstation find its domain controller?

    8.3.1. How does a Workstation find its domain controller?

    A NT workstation in the domain SAMBA that wants a local user to be authenticated has to find the domain controller for SAMBA. It does @@ -178,9 +178,9 @@ CLASS="SECT2" >

    7.3.2. When is the PDC needed?

    8.3.2. When is the PDC needed?

    Whenever a user wants to change his password, this has to be done on the PDC. To find the PDC, the workstation does a NetBIOS name query @@ -194,9 +194,9 @@ CLASS="SECT1" >

    7.4. Can Samba be a Backup Domain Controller?

    8.4. Can Samba be a Backup Domain Controller?

    With version 2.2, no. The native NT SAM replication protocols have not yet been fully implemented. The Samba Team is working on @@ -213,9 +213,9 @@ CLASS="SECT1" >

    7.5. How do I set up a Samba BDC?

    8.5. How do I set up a Samba BDC?

    Several things have to be done:

    7.5.1. How do I replicate the smbpasswd file?

    8.5.1. How do I replicate the smbpasswd file?

    Replication of the smbpasswd file is sensitive. It has to be done whenever changes to the SAM are made. Every user's password change is @@ -348,7 +348,7 @@ WIDTH="34%" ALIGN="center" VALIGN="top" >UpLast Update : Thu Aug 15 12:48:45 CDT 2002

    : $Date: 2002/11/13 15:34:49 $

    This book is a collection of HOWTOs added to Samba documentation over the years. I try to ensure that all are current, but sometimes the is a larger job @@ -62,6 +62,11 @@ on the "Documentation" page. Please send updates to jerry@samba.org or +jelmer@samba.org.

    This documentation is distributed under the GNU General Public License (GPL) @@ -82,7 +87,7 @@ CLASS="TOC" >

    I. General installation
    1.1. Read the man pages
    1.2. Building the Binaries
    1.3. The all important step
    1.4. Create the smb configuration file.
    1.5. Test your config file with
    1.6. Starting the smbd and nmbd
    1.7. Try listing the shares available on your server
    1.8. Try connecting with the unix client
    1.9. Try connecting from a DOS, WfWg, Win9x, WinNT, Win2k, OS/2, etc... client
    1.10. What If Things Don't Work?
    2.1. Overview of browsing
    2.2. Browsing support in samba
    2.3. Problem resolution
    2.4. Browsing across subnets
    2.5. Setting up a WINS server
    2.6. Setting up Browsing in a WORKGROUP
    2.7. Setting up Browsing in a DOMAIN
    2.8. Forcing samba to be the master
    2.9. Making samba the domain master
    2.10. Note about broadcast addresses
    2.11. Multiple interfaces
    3.1. What are oplocks?
    4.1. Discussion
    4.2. Use of the "Remote Announce" parameter
    4.3. Use of the "Remote Browse Sync" parameter
    4.4. Use of WINS
    4.5. Do NOT use more than one (1) protocol on MS Windows machines
    4.6. Name Resolution Order
    5.1. Introduction
    5.2. Important Notes About Security
    5.3. The smbpasswd Command
    II. Type of installation
    6. User and Share security level (for servers not in a domain)
    7. How to Configure Samba as a NT4 Primary Domain Controller
    6.1. 7.1. Prerequisite Reading
    6.2. 7.2. Background
    6.3. 7.3. Configuring the Samba Domain Controller
    6.4. 7.4. Creating Machine Trust Accounts and Joining Clients to the Domain
    6.5. 7.5. Common Problems and Errors
    6.6. 7.6. System Policies and Profiles
    6.7. 7.7. What other help can I get?
    6.8. 7.8. Domain Control for Windows 9x/ME
    6.9. 7.9. DOMAIN_CONTROL.txt : Windows NT Domain Control & Samba
    7. 8. How to Act as a Backup Domain Controller in a Purely Samba Controlled Domain
    7.1. 8.1. Prerequisite Reading
    7.2. 8.2. Background
    7.3. 8.3. What qualifies a Domain Controller on the network?
    7.4. 8.4. Can Samba be a Backup Domain Controller?
    7.5. 8.5. How do I set up a Samba BDC?
    8. 9. Samba as a ADS domain member
    8.1. 9.1. Installing the required packages for Debian
    8.2. 9.2. Installing the required packages for RedHat
    8.3. 9.3. Compile Samba
    8.4. 9.4. Setup your /etc/krb5.conf
    8.5. 9.5. Create the computer account
    8.6. 9.6. Test your server setup
    8.7. 9.7. Testing with smbclient
    8.8. 9.8. Notes
    9. 10. Samba as a NT4 domain member
    9.1. 10.1. Joining an NT Domain with Samba 2.2
    9.2. 10.2. Samba and Windows 2000 Domains
    9.3. 10.3. Why is this better than security = server?
    III. Optional configuration
    10. 11. Integrating MS Windows networks with Samba
    10.1. 11.1. Agenda
    10.2. 11.2. Name Resolution in a pure Unix/Linux world
    10.3. 11.3. Name resolution as used within MS Windows networking
    10.4. 11.4. How browsing functions and how to deploy stable and dependable browsing using Samba
    10.5. 11.5. MS Windows security options and how to configure Samba for seemless integration
    10.6. 11.6. Conclusions
    11. 12. UNIX Permission Bits and Windows NT Access Control Lists
    11.1. 12.1. Viewing and changing UNIX permissions using the NT security dialogs
    11.2. 12.2. How to view file security on a Samba share
    11.3. 12.3. Viewing file ownership
    11.4. 12.4. Viewing file or directory permissions
    11.5. 12.5. Modifying file or directory permissions
    11.6. 12.6. Interaction with the standard Samba create mask parameters
    11.7. 12.7. Interaction with the standard Samba file attribute mapping
    12. 13. Configuring PAM for distributed but centrally managed authentication
    12.1. 13.1. Samba and PAM
    12.2. 13.2. Distributed Authentication
    12.3. 13.3. PAM Configuration in smb.conf
    13. 14. Hosting a Microsoft Distributed File System tree on Samba
    13.1. 14.1. Instructions
    14. 15. Printing Support
    14.1. 15.1. Introduction
    14.2. 15.2. Configuration
    14.3. 15.3. The Imprints Toolset
    14.4. 15.4. Diagnosis
    15. Security levels
    15.1. Introduction
    15.2. More complete description of security levels
    16. Unified Logons between Windows NT and UNIX using Winbind
    16.1. Abstract
    16.2. Introduction
    16.3. What Winbind Provides
    16.4. How Winbind Works
    16.5. Installation and Configuration
    16.6. Limitations
    16.7. Conclusion
    17.1. Building
    17.2. Configuring
    17.3. Using plaintext passwords or encrypted password
    17.4. Getting non-column data from the table
    18.1. Building
    18.2. Usage
    19. Stackable VFS modules
    19.1. Introduction and configuration
    19.2. Included modules
    19.3. VFS modules available elsewhere
    20. Storing Samba's User/Machine Account information in an LDAP Directory
    19.1. 20.1. Purpose
    19.2. 20.2. Introduction
    19.3. 20.3. Supported LDAP Servers
    19.4. 20.4. Schema and Relationship to the RFC 2307 posixAccount
    19.5. 20.5. Configuring Samba with LDAP
    19.6. 20.6. Accounts and Groups management
    19.7. 20.7. Security and sambaAccount
    19.8. 20.8. LDAP specials attributes for sambaAccounts
    19.9. 20.9. Example LDIF Entries for a sambaAccount
    19.10. 20.10. Comments
    20. 21. HOWTO Access Samba source code via CVS
    20.1. 21.1. Introduction
    20.2. 21.2. CVS Access to samba.org
    21. 22. Group mapping HOWTO
    22. 23. Samba performance issues
    22.1. 23.1. Comparisons
    22.2. 23.2. Oplocks
    22.3. 23.3. Socket options
    22.4. 23.4. Read size
    22.5. 23.5. Max xmit
    22.6. 23.6. Locking
    22.7. 23.7. Share modes
    22.8. 23.8. Log level
    22.9. 23.9. Wide lines
    22.10. 23.10. Read raw
    22.11. 23.11. Write raw
    22.12. 23.12. Read prediction
    22.13. 23.13. Memory mapping
    22.14. 23.14. Slow Clients
    22.15. 23.15. Slow Logins
    22.16. 23.16. Client tuning
    22.17. 23.17. My Results
    IV. Appendixes
    23. 24. Portability
    23.1. 24.1. HPUX
    23.2. 24.2. SCO Unix
    23.3. 24.3. DNIX
    23.4. 24.4. RedHat Linux Rembrandt-II
    24. 25. Samba and other CIFS clients
    24.1. 25.1. Macintosh clients?
    24.2. 25.2. OS2 Client
    24.3. 25.3. Windows for Workgroups
    24.4. 25.4. Windows '95/'98
    24.5. 25.5. Windows 2000 Service Pack 2
    25. 26. Reporting Bugs
    25.1. 26.1. Introduction
    25.2. 26.2. General info
    25.3. 26.3. Debug levels
    25.4. 26.4. Internal errors
    25.5. 26.5. Attaching to a running process
    25.6. 26.6. Patches
    26. 27. Diagnosing your samba server
    26.1. 27.1. Introduction
    26.2. 27.2. Assumptions
    26.3. 27.3. Tests
    26.4. 27.4. Still having troubles?
    NextPrevChapter 19. Storing Samba's User/Machine Account information in an LDAP DirectoryChapter 20. Storing Samba's User/Machine Account information in an LDAP Directory

    19.1. Purpose

    20.1. Purpose

    This document describes how to use an LDAP directory for storing Samba user account information traditionally stored in the smbpasswd(5) file. It is @@ -148,9 +148,9 @@ CLASS="SECT1" >

    19.2. Introduction

    20.2. Introduction

    Traditionally, when configuring

    19.3. Supported LDAP Servers

    20.3. Supported LDAP Servers

    The LDAP samdb code in 2.2.3 has been developed and tested using the OpenLDAP 2.0 server and client libraries. The same code should be able to work with @@ -290,9 +290,9 @@ CLASS="SECT1" >

    19.4. Schema and Relationship to the RFC 2307 posixAccount

    20.4. Schema and Relationship to the RFC 2307 posixAccount

    Samba 2.2.3 includes the necessary schema file for OpenLDAP 2.0 in

    19.5. Configuring Samba with LDAP

    20.5. Configuring Samba with LDAP

    19.5.1. OpenLDAP configuration

    20.5.1. OpenLDAP configuration

    To include support for the sambaAccount object in an OpenLDAP directory server, first copy the samba.schema file to slapd's configuration directory.

    19.5.2. Configuring Samba

    20.5.2. Configuring Samba

    The following parameters are available in smb.conf only with

    19.6. Accounts and Groups management

    20.6. Accounts and Groups management

    As users accounts are managed thru the sambaAccount objectclass, you should modify you existing administration tools to deal with sambaAccount attributes.

    19.7. Security and sambaAccount

    20.7. Security and sambaAccount

    There are two important points to remember when discussing the security of sambaAccount entries in the directory.

    19.8. LDAP specials attributes for sambaAccounts

    20.8. LDAP specials attributes for sambaAccounts

    The sambaAccount objectclass is composed of the following attributes:

    19.9. Example LDIF Entries for a sambaAccount

    20.9. Example LDIF Entries for a sambaAccount

    The following is a working LDIF with the inclusion of the posixAccount objectclass:

    19.10. Comments

    20.10. Comments

    Please mail all comments regarding this HOWTO to PrevPassdb XML pluginStackable VFS modulesUpPrevChapter 6. How to Configure Samba as a NT4 Primary Domain ControllerChapter 7. How to Configure Samba as a NT4 Primary Domain Controller

    6.1. Prerequisite Reading

    7.1. Prerequisite Reading

    Before you continue reading in this chapter, please make sure that you are comfortable with configuring basic files services @@ -108,9 +108,9 @@ CLASS="SECT1" >

    6.2. Background

    7.2. Background

    6.3. Configuring the Samba Domain Controller

    7.3. Configuring the Samba Domain Controller

    The first step in creating a working Samba PDC is to understand the parameters necessary in smb.conf. I will not @@ -472,9 +472,9 @@ CLASS="SECT1" >

    6.4. Creating Machine Trust Accounts and Joining Clients to the +>7.4. Creating Machine Trust Accounts and Joining Clients to the Domain

    A machine trust account is a Samba account that is used to @@ -546,9 +546,9 @@ CLASS="SECT2" >

    6.4.1. Manual Creation of Machine Trust Accounts

    7.4.1. Manual Creation of Machine Trust Accounts

    The first step in manually creating a machine trust account is to manually create the corresponding Unix account in @@ -736,9 +736,9 @@ CLASS="SECT2" >

    6.4.2. "On-the-Fly" Creation of Machine Trust Accounts

    7.4.2. "On-the-Fly" Creation of Machine Trust Accounts

    The second (and recommended) way of creating machine trust accounts is simply to allow the Samba server to create them as needed when the client @@ -773,9 +773,9 @@ CLASS="SECT2" >

    6.4.3. Joining the Client to the Domain

    7.4.3. Joining the Client to the Domain

    The procedure for joining a client to the domain varies with the version of Windows.

    6.5. Common Problems and Errors

    7.5. Common Problems and Errors

    6.6. System Policies and Profiles

    7.6. System Policies and Profiles

    Much of the information necessary to implement System Policies and Roving User Profiles in a Samba domain is the same as that for @@ -1228,9 +1228,9 @@ CLASS="SECT1" >

    6.7. What other help can I get?

    7.7. What other help can I get?

    There are many sources of information available in the form of mailing lists, RFC's and documentation. The docs that come @@ -1648,9 +1648,9 @@ CLASS="SECT1" >

    6.8. Domain Control for Windows 9x/ME

    7.8. Domain Control for Windows 9x/ME

    6.8.1. Configuration Instructions: Network Logons

    7.8.1. Configuration Instructions: Network Logons

    The main difference between a PDC and a Windows 9x logon server configuration is that

    6.8.2. Configuration Instructions: Setting up Roaming User Profiles

    7.8.2. Configuration Instructions: Setting up Roaming User Profiles

    6.8.2.1. Windows NT Configuration

    7.8.2.1. Windows NT Configuration

    To support WinNT clients, in the [global] section of smb.conf set the following (for example):

    6.8.2.2. Windows 9X Configuration

    7.8.2.2. Windows 9X Configuration

    To support Win9X clients, you must use the "logon home" parameter. Samba has now been fixed so that "net use/home" now works as well, and it, too, relies @@ -2023,9 +2023,9 @@ CLASS="SECT3" >

    6.8.2.3. Win9X and WinNT Configuration

    7.8.2.3. Win9X and WinNT Configuration

    You can support profiles for both Win9X and WinNT clients by setting both the "logon home" and "logon path" parameters. For example:

    6.8.2.4. Windows 9X Profile Setup

    7.8.2.4. Windows 9X Profile Setup

    When a user first logs in on Windows 9X, the file user.DAT is created, as are folders "Start Menu", "Desktop", "Programs" and "Nethood". @@ -2228,9 +2228,9 @@ CLASS="SECT3" >

    6.8.2.5. Windows NT Workstation 4.0

    7.8.2.5. Windows NT Workstation 4.0

    When a user first logs in to a Windows NT Workstation, the profile NTuser.DAT is created. The profile location can be now specified @@ -2342,9 +2342,9 @@ CLASS="SECT3" >

    6.8.2.6. Windows NT Server

    7.8.2.6. Windows NT Server

    There is nothing to stop you specifying any path that you like for the location of users' profiles. Therefore, you could specify that the @@ -2356,9 +2356,9 @@ CLASS="SECT3" >

    6.8.2.7. Sharing Profiles between W95 and NT Workstation 4.0

    7.8.2.7. Sharing Profiles between W95 and NT Workstation 4.0

    6.9. DOMAIN_CONTROL.txt : Windows NT Domain Control & Samba

    7.9. DOMAIN_CONTROL.txt : Windows NT Domain Control & Samba

    PrevType of installationUser and Share security level (for servers not in a domain)UpSecurity levelsUser and Share security level (for servers not in a domain)PrevNextChapter 15. Security levels

    15.1. Introduction

    Samba supports the following options to the global smb.conf parameter

    [global]
    -security = [share|user(default)|server|domain|ads]

    Please refer to the smb.conf man page for usage information and to the document -DOMAIN_MEMBER.html for further background details -on domain mode security. The Windows 2000 Kerberos domain security model -(security = ads) is described in the ADS-HOWTO.html.

    Of the above, "security = server" means that Samba reports to clients that -it is running in "user mode" but actually passes off all authentication -requests to another "user mode" server. This requires an additional -parameter "password server =" that points to the real authentication server. -That real authentication server can be another Samba server or can be a -Windows NT server, the later natively capable of encrypted password support.

    15.2. More complete description of security levels

    Chapter 6. User and Share security level (for servers not in a domain)

    A SMB server tells the client at startup what "security level" it is running. There are two options "share level" and "user level". Which @@ -214,7 +160,13 @@ smbpasswd file with SMB style encrypted passwords. It is cryptographically impossible to translate from unix style encryption to SMB style encryption, although there are some fairly simple management schemes by which the two could be kept in sync.

    "security = server" means that Samba reports to clients that +it is running in "user mode" but actually passes off all authentication +requests to another "user mode" server. This requires an additional +parameter "password server =" that points to the real authentication server. +That real authentication server can be another Samba server or can be a +Windows NT server, the later natively capable of encrypted password support.

    NextChapter 22. Samba performance issuesChapter 23. Samba performance issues

    22.1. Comparisons

    23.1. Comparisons

    The Samba server uses TCP to talk to the client. Thus if you are trying to see if it performs well you should really compare it to @@ -111,17 +111,17 @@ CLASS="SECT1" >

    22.2. Oplocks

    23.2. Oplocks

    22.2.1. Overview

    23.2.1. Overview

    Oplocks are the way that SMB clients get permission from a server to locally cache file operations. If a server grants an oplock @@ -155,9 +155,9 @@ CLASS="SECT2" >

    22.2.2. Level2 Oplocks

    23.2.2. Level2 Oplocks

    With Samba 2.0.5 a new capability - level2 (read only) oplocks is supported (although the option is off by default - see the smb.conf @@ -179,9 +179,9 @@ CLASS="SECT2" >

    22.2.3. Old 'fake oplocks' option - deprecated

    23.2.3. Old 'fake oplocks' option - deprecated

    Samba can also fake oplocks, by granting a oplock whenever a client asks for one. This is controlled using the smb.conf option "fake @@ -200,9 +200,9 @@ CLASS="SECT1" >

    22.3. Socket options

    23.3. Socket options

    There are a number of socket options that can greatly affect the performance of a TCP based server like Samba.

    22.4. Read size

    23.4. Read size

    The option "read size" affects the overlap of disk reads/writes with network reads/writes. If the amount of data being transferred in @@ -254,9 +254,9 @@ CLASS="SECT1" >

    22.5. Max xmit

    23.5. Max xmit

    At startup the client and server negotiate a "maximum transmit" size, which limits the size of nearly all SMB commands. You can set the @@ -277,9 +277,9 @@ CLASS="SECT1" >

    22.6. Locking

    23.6. Locking

    By default Samba does not implement strict locking on each read/write call (although it did in previous versions). If you enable strict @@ -294,9 +294,9 @@ CLASS="SECT1" >

    22.7. Share modes

    23.7. Share modes

    Some people find that opening files is very slow. This is often because of the "share modes" code needed to fully implement the dos @@ -324,9 +324,9 @@ CLASS="SECT1" >

    22.8. Log level

    23.8. Log level

    If you set the log level (also known as "debug level") higher than 2 then you may suffer a large drop in performance. This is because the @@ -338,9 +338,9 @@ CLASS="SECT1" >

    22.9. Wide lines

    23.9. Wide lines

    The "wide links" option is now enabled by default, but if you disable it (for better security) then you may suffer a performance hit in @@ -352,9 +352,9 @@ CLASS="SECT1" >

    22.10. Read raw

    23.10. Read raw

    The "read raw" operation is designed to be an optimised, low-latency file read operation. A server may choose to not support it, @@ -374,9 +374,9 @@ CLASS="SECT1" >

    22.11. Write raw

    23.11. Write raw

    The "write raw" operation is designed to be an optimised, low-latency file write operation. A server may choose to not support it, @@ -391,9 +391,9 @@ CLASS="SECT1" >

    22.12. Read prediction

    23.12. Read prediction

    Samba can do read prediction on some of the SMB commands. Read prediction means that Samba reads some extra data on the last file it @@ -417,9 +417,9 @@ CLASS="SECT1" >

    22.13. Memory mapping

    23.13. Memory mapping

    Samba supports reading files via memory mapping them. One some machines this can give a large boost to performance, on others it @@ -438,9 +438,9 @@ CLASS="SECT1" >

    22.14. Slow Clients

    23.14. Slow Clients

    One person has reported that setting the protocol to COREPLUS rather than LANMAN2 gave a dramatic speed improvement (from 10k/s to 150k/s).

    22.15. Slow Logins

    23.15. Slow Logins

    Slow logins are almost always due to the password checking time. Using the lowest practical "password level" will improve things a lot. You @@ -468,9 +468,9 @@ CLASS="SECT1" >

    22.16. Client tuning

    23.16. Client tuning

    Often a speed problem can be traced to the client. The client (for example Windows for Workgroups) can often be tuned for better TCP @@ -572,9 +572,9 @@ CLASS="SECT1" >

    22.17. My Results

    23.17. My Results

    Some people want to see real numbers in a document like this, so here they are. I have a 486sx33 client running WfWg 3.11 with the 3.11b @@ -631,7 +631,7 @@ WIDTH="33%" ALIGN="right" VALIGN="top" >NextUp +Type of installation

    SAMBA Project Documentation
    PrevNext

    II. Type of installation

    Introduction

    Samba can operate in various SMB networks. This part contains information on configuring samba +for various environments.

    Table of Contents
    6. User and Share security level (for servers not in a domain)
    7. How to Configure Samba as a NT4 Primary Domain Controller
    7.1. Prerequisite Reading
    7.2. Background
    7.3. Configuring the Samba Domain Controller
    7.4. Creating Machine Trust Accounts and Joining Clients to the +Domain
    7.4.1. Manual Creation of Machine Trust Accounts
    7.4.2. "On-the-Fly" Creation of Machine Trust Accounts
    7.4.3. Joining the Client to the Domain
    7.5. Common Problems and Errors
    7.6. System Policies and Profiles
    7.7. What other help can I get?
    7.8. Domain Control for Windows 9x/ME
    7.8.1. Configuration Instructions: Network Logons
    7.8.2. Configuration Instructions: Setting up Roaming User Profiles
    7.9. DOMAIN_CONTROL.txt : Windows NT Domain Control & Samba
    8. How to Act as a Backup Domain Controller in a Purely Samba Controlled Domain
    8.1. Prerequisite Reading
    8.2. Background
    8.3. What qualifies a Domain Controller on the network?
    8.3.1. How does a Workstation find its domain controller?
    8.3.2. When is the PDC needed?
    8.4. Can Samba be a Backup Domain Controller?
    8.5. How do I set up a Samba BDC?
    8.5.1. How do I replicate the smbpasswd file?
    9. Samba as a ADS domain member
    9.1. Installing the required packages for Debian
    9.2. Installing the required packages for RedHat
    9.3. Compile Samba
    9.4. Setup your /etc/krb5.conf
    9.5. Create the computer account
    9.5.1. Possible errors
    9.6. Test your server setup
    9.7. Testing with smbclient
    9.8. Notes
    10. Samba as a NT4 domain member
    10.1. Joining an NT Domain with Samba 2.2
    10.2. Samba and Windows 2000 Domains
    10.3. Why is this better than security = server?

    PrevHomeNext
    LanMan and NT Password Encryption in Samba User and Share security level (for servers not in a domain)
    \ No newline at end of file diff --git a/docs/htmldocs/unix-permissions.html b/docs/htmldocs/unix-permissions.html index 153a0e82bc4..864fedea7bc 100644 --- a/docs/htmldocs/unix-permissions.html +++ b/docs/htmldocs/unix-permissions.html @@ -11,7 +11,7 @@ TITLE="SAMBA Project Documentation" HREF="samba-howto-collection.html">Chapter 11. UNIX Permission Bits and Windows NT Access Control ListsChapter 12. UNIX Permission Bits and Windows NT Access Control Lists

    11.1. Viewing and changing UNIX permissions using the NT +>12.1. Viewing and changing UNIX permissions using the NT security dialogs

    New in the Samba 2.0.4 release is the ability for Windows @@ -120,9 +120,9 @@ CLASS="SECT1" >

    11.2. How to view file security on a Samba share

    12.2. How to view file security on a Samba share

    From an NT 4.0 client, single-click with the right mouse button on any file or directory in a Samba mounted @@ -190,9 +190,9 @@ CLASS="SECT1" >

    11.3. Viewing file ownership

    12.3. Viewing file ownership

    Clicking on the

    11.4. Viewing file or directory permissions

    12.4. Viewing file or directory permissions

    The third button is the

    11.4.1. File Permissions

    12.4.1. File Permissions

    The standard UNIX user/group/world triple and the corresponding "read", "write", "execute" permissions @@ -408,9 +408,9 @@ CLASS="SECT2" >

    11.4.2. Directory Permissions

    12.4.2. Directory Permissions

    Directories on an NT NTFS file system have two different sets of permissions. The first set of permissions @@ -440,9 +440,9 @@ CLASS="SECT1" >

    11.5. Modifying file or directory permissions

    12.5. Modifying file or directory permissions

    Modifying file and directory permissions is as simple as changing the displayed permissions in the dialog box, and @@ -538,9 +538,9 @@ CLASS="SECT1" >

    11.6. Interaction with the standard Samba create mask +>12.6. Interaction with the standard Samba create mask parameters

    Note that with Samba 2.0.5 there are four new parameters @@ -815,9 +815,9 @@ CLASS="SECT1" >

    11.7. Interaction with the standard Samba file attribute +>12.7. Interaction with the standard Samba file attribute mapping

    Samba maps some of the DOS attribute bits (such as "read @@ -908,7 +908,7 @@ WIDTH="34%" ALIGN="center" VALIGN="top" >Up +Stackable VFS modules

    SAMBA Project Documentation
    PrevNext

    Chapter 19. Stackable VFS modules

    19.1. Introduction and configuration

    Since samba 3.0, samba supports stackable VFS(Virtual File System) modules. +Samba passes each request to access the unix file system thru the loaded VFS modules. +This chapter covers all the modules that come with the samba source and references to +some external modules.

    You may have problems to compile these modules, as shared libraries are +compiled and linked in different ways on different systems. +I currently tested them against GNU/linux and IRIX.

    To use the VFS modules, create a share similar to the one below. The +important parameter is the vfs object parameter which must point to +the exact pathname of the shared library object. For example, to use audit.so: + +

           [audit]
    +                comment = Audited /data directory
    +                path = /data
    +                vfs object = /path/to/audit.so
    +                writeable = yes
    +                browseable = yes

    Further documentation on writing VFS modules for Samba can be found in +docs directory of the Samba source distribution.

    19.2. Included modules

    19.2.1. audit

    A simple module to audit file access to the syslog +facility. The following operations are logged: +

    share
    connect/disconnect
    directory opens/create/remove
    file open/close/rename/unlink/chmod

    19.2.2. recycle

    A recycle-bin like modules. When used any unlink call +will be intercepted and files moved to the recycle +directory instead of beeing deleted.

    Supported options: +

    vfs_recycle_bin:repository

    FIXME

    vfs_recycle_bin:keeptree

    FIXME

    vfs_recycle_bin:versions

    FIXME

    vfs_recycle_bin:touch

    FIXME

    vfs_recycle_bin:maxsize

    FIXME

    vfs_recycle_bin:exclude

    FIXME

    vfs_recycle_bin:exclude_dir

    FIXME

    vfs_recycle_bin:noversions

    FIXME

    19.2.3. netatalk

    A netatalk module, that will ease co-existence of samba and +netatalk file sharing services.

    Advantages compared to the old netatalk module: +

    it doesn't care about creating of .AppleDouble forks, just keeps ones in sync
    if share in smb.conf doesn't contain .AppleDouble item in hide or veto list, it will be added automatically

    19.3. VFS modules available elsewhere

    This section contains a listing of various other VFS modules that +have been posted but don't currently reside in the Samba CVS +tree for one reason ot another (e.g. it is easy for the maintainer +to have his or her own CVS tree).

    No statemets about the stability or functionality any module +should be implied due to its presence here.

    19.3.1. DatabaseFS

    URL: http://www.css.tayloru.edu/~elorimer/databasefs/index.php

    By Eric Lorimer.

    I have created a VFS module which implements a fairly complete read-only +filesystem. It presents information from a database as a filesystem in +a modular and generic way to allow different databases to be used +(originally designed for organizing MP3s under directories such as +"Artists," "Song Keywords," etc... I have since applied it to a student +roster database very easily). The directory structure is stored in the +database itself and the module makes no assumptions about the database +structure beyond the table it requires to run.

    Any feedback would be appreciated: comments, suggestions, patches, +etc... If nothing else, hopefully it might prove useful for someone +else who wishes to create a virtual filesystem.

    19.3.2. vscan

    URL: http://www.openantivirus.org/

    samba-vscan is a proof-of-concept module for Samba, which +uses the VFS (virtual file system) features of Samba 2.2.x/3.0 +alphaX. Of couse, Samba has to be compiled with VFS support. +samba-vscan supports various virus scanners and is maintained +by Rainer Link.


    PrevHomeNext
    Passdb XML pluginUpStoring Samba's User/Machine Account information in an LDAP Directory
    \ No newline at end of file diff --git a/docs/htmldocs/winbind.html b/docs/htmldocs/winbind.html index 016d77cac15..df5a59f7719 100644 --- a/docs/htmldocs/winbind.html +++ b/docs/htmldocs/winbind.html @@ -11,10 +11,10 @@ TITLE="SAMBA Project Documentation" HREF="samba-howto-collection.html">Prev

    16.1. Abstract

    16.2. Introduction

    16.3. What Winbind Provides

    16.3.1. Target Uses

    16.4. How Winbind Works

    16.4.1. Microsoft Remote Procedure Calls

    16.4.2. Name Service Switch

    16.4.3. Pluggable Authentication Modules

    16.4.4. User and Group ID Allocation

    16.4.5. Result Caching

    16.5. Installation and Configuration

    16.5.1. Introduction

    16.5.2. Requirements

    16.5.3. Testing Things Out

    16.5.3.1. Configure and compile SAMBA

    16.5.3.2. Configure

    16.5.3.3. Configure smb.conf

    16.5.3.4. Join the SAMBA server to the PDC domain

    16.5.3.5. Start up the winbindd daemon and test it!

    16.5.3.6. Fix the init.d startup scripts

    16.5.3.6.1. Linux

    16.5.3.6.2. Solaris

    16.5.3.6.3. Restarting

    16.5.3.7. Configure Winbind and PAM

    16.5.3.7.1. Linux/FreeBSD-specific PAM configuration

    16.5.3.7.2. Solaris-specific configuration

    16.6. Limitations

    16.7. Conclusion

    PrevSecurity levelsPrinting SupportUp Date: Wed, 13 Nov 2002 19:04:17 +0000 Subject: Load modules in lp_modules() after fork() (This used to be commit 77afa4f1679c22cde88ecc5bc7ed37951c822221) --- source3/smbd/server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 342c7c85cff..e9092858f4b 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -373,6 +373,10 @@ static BOOL open_sockets_smbd(BOOL is_daemon,const char *smb_ports) return False; } + /* Load DSO's */ + if(lp_modules()) + smb_load_modules(lp_modules()); + return True; } /* The parent doesn't need this socket */ -- cgit From 3dc6b9e5f0cb2e3e28ec4864ccc369528844ea29 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 19:07:34 +0000 Subject: Move 'weird' character set into new 'developer' module (This used to be commit afbff33eba7edd98329114b5113b3360cd6dfcc6) --- source3/Makefile.in | 6 +- source3/lib/iconv.c | 108 ------------------------------------ source3/modules/developer.c | 132 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+), 111 deletions(-) create mode 100644 source3/modules/developer.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 8538bd56d6a..af14c6a9f83 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -116,7 +116,7 @@ SCRIPTS = $(srcdir)/script/smbtar $(srcdir)/script/addtosmbpass $(srcdir)/script QUOTAOBJS=@QUOTAOBJS@ -MODULES = bin/vfs_audit.so bin/vfs_recycle.so bin/vfs_netatalk.so @MODULE_PDB_MYSQL@ @MODULE_PDB_XML@ +MODULES = bin/vfs_audit.so bin/vfs_recycle.so bin/vfs_netatalk.so bin/developer.so @MODULE_PDB_MYSQL@ @MODULE_PDB_XML@ ###################################################################### # object file lists @@ -984,7 +984,7 @@ TOPFILES=dynconfig.o dynconfig.po clean: delheaders python_clean -rm -f core */*~ *~ */*.o */*.po */*.po32 */*.@SHLIBEXT@ \ - $(TOPFILES) $(PROGS) $(SPROGS) .headers.stamp + $(TOPFILES) $(PROGS) $(SPROGS) $(MODULES) .headers.stamp # Making this target will just make sure that the prototype files # exist, not necessarily that they are up to date. Since they're @@ -1061,7 +1061,7 @@ ctags: ctags `find $(srcdir) -name "*.[ch]" | grep -v /CVS/` realclean: clean delheaders - -rm -f config.log $(PROGS) $(SPROGS) bin/.dummy script/findsmb + -rm -f config.log $(PROGS) $(MODULES) $(SPROGS) bin/.dummy script/findsmb distclean: realclean -rm -f include/stamp-h diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c index 3498f976b3e..e54a74864e1 100644 --- a/source3/lib/iconv.c +++ b/source3/lib/iconv.c @@ -25,8 +25,6 @@ static size_t ascii_pull(void *,char **, size_t *, char **, size_t *); static size_t ascii_push(void *,char **, size_t *, char **, size_t *); static size_t utf8_pull(void *,char **, size_t *, char **, size_t *); static size_t utf8_push(void *,char **, size_t *, char **, size_t *); -static size_t weird_pull(void *,char **, size_t *, char **, size_t *); -static size_t weird_push(void *,char **, size_t *, char **, size_t *); static size_t ucs2hex_pull(void *,char **, size_t *, char **, size_t *); static size_t ucs2hex_push(void *,char **, size_t *, char **, size_t *); static size_t iconv_copy(void *,char **, size_t *, char **, size_t *); @@ -35,7 +33,6 @@ struct charset_functions builtin_functions[] = { {"UCS-2LE", iconv_copy, iconv_copy}, {"UTF8", utf8_pull, utf8_push}, {"ASCII", ascii_pull, ascii_push}, - {"WEIRD", weird_pull, weird_push}, {"UCS2-HEX", ucs2hex_pull, ucs2hex_push}, {NULL, NULL, NULL} }; @@ -384,111 +381,6 @@ static size_t ucs2hex_push(void *cd, char **inbuf, size_t *inbytesleft, } -/* the "weird" character set is very useful for testing multi-byte - support and finding bugs. Don't use on a production system! -*/ -static struct { - char from; - char *to; - int len; -} weird_table[] = { - {'q', "^q^", 3}, - {'Q', "^Q^", 3}, - {0, NULL} -}; - -static size_t weird_pull(void *cd, char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft) -{ - while (*inbytesleft >= 1 && *outbytesleft >= 2) { - int i; - int done = 0; - for (i=0;weird_table[i].from;i++) { - if (strncmp((*inbuf), - weird_table[i].to, - weird_table[i].len) == 0) { - if (*inbytesleft < weird_table[i].len) { - DEBUG(0,("ERROR: truncated weird string\n")); - /* smb_panic("weird_pull"); */ - - } else { - (*outbuf)[0] = weird_table[i].from; - (*outbuf)[1] = 0; - (*inbytesleft) -= weird_table[i].len; - (*outbytesleft) -= 2; - (*inbuf) += weird_table[i].len; - (*outbuf) += 2; - done = 1; - break; - } - } - } - if (done) continue; - (*outbuf)[0] = (*inbuf)[0]; - (*outbuf)[1] = 0; - (*inbytesleft) -= 1; - (*outbytesleft) -= 2; - (*inbuf) += 1; - (*outbuf) += 2; - } - - if (*inbytesleft > 0) { - errno = E2BIG; - return -1; - } - - return 0; -} - -static size_t weird_push(void *cd, char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft) -{ - int ir_count=0; - - while (*inbytesleft >= 2 && *outbytesleft >= 1) { - int i; - int done=0; - for (i=0;weird_table[i].from;i++) { - if ((*inbuf)[0] == weird_table[i].from && - (*inbuf)[1] == 0) { - if (*outbytesleft < weird_table[i].len) { - DEBUG(0,("No room for weird character\n")); - /* smb_panic("weird_push"); */ - } else { - memcpy(*outbuf, weird_table[i].to, - weird_table[i].len); - (*inbytesleft) -= 2; - (*outbytesleft) -= weird_table[i].len; - (*inbuf) += 2; - (*outbuf) += weird_table[i].len; - done = 1; - break; - } - } - } - if (done) continue; - - (*outbuf)[0] = (*inbuf)[0]; - if ((*inbuf)[1]) ir_count++; - (*inbytesleft) -= 2; - (*outbytesleft) -= 1; - (*inbuf) += 2; - (*outbuf) += 1; - } - - if (*inbytesleft == 1) { - errno = EINVAL; - return -1; - } - - if (*inbytesleft > 1) { - errno = E2BIG; - return -1; - } - - return ir_count; -} - static size_t iconv_copy(void *cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { diff --git a/source3/modules/developer.c b/source3/modules/developer.c new file mode 100644 index 00000000000..c12bbc562ad --- /dev/null +++ b/source3/modules/developer.c @@ -0,0 +1,132 @@ +/* + Unix SMB/CIFS implementation. + Samba module with developer tools + Copyright (C) Andrew Tridgell 2001 + Copyright (C) Jelmer Vernooij 2002 + + 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 + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + 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. +*/ + +#include "includes.h" + +static struct { + char from; + char *to; + int len; +} weird_table[] = { + {'q', "^q^", 3}, + {'Q', "^Q^", 3}, + {0, NULL} +}; + +static size_t weird_pull(void *cd, char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + while (*inbytesleft >= 1 && *outbytesleft >= 2) { + int i; + int done = 0; + for (i=0;weird_table[i].from;i++) { + if (strncmp((*inbuf), + weird_table[i].to, + weird_table[i].len) == 0) { + if (*inbytesleft < weird_table[i].len) { + DEBUG(0,("ERROR: truncated weird string\n")); + /* smb_panic("weird_pull"); */ + + } else { + (*outbuf)[0] = weird_table[i].from; + (*outbuf)[1] = 0; + (*inbytesleft) -= weird_table[i].len; + (*outbytesleft) -= 2; + (*inbuf) += weird_table[i].len; + (*outbuf) += 2; + done = 1; + break; + } + } + } + if (done) continue; + (*outbuf)[0] = (*inbuf)[0]; + (*outbuf)[1] = 0; + (*inbytesleft) -= 1; + (*outbytesleft) -= 2; + (*inbuf) += 1; + (*outbuf) += 2; + } + + if (*inbytesleft > 0) { + errno = E2BIG; + return -1; + } + + return 0; +} + +static size_t weird_push(void *cd, char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + int ir_count=0; + + while (*inbytesleft >= 2 && *outbytesleft >= 1) { + int i; + int done=0; + for (i=0;weird_table[i].from;i++) { + if ((*inbuf)[0] == weird_table[i].from && + (*inbuf)[1] == 0) { + if (*outbytesleft < weird_table[i].len) { + DEBUG(0,("No room for weird character\n")); + /* smb_panic("weird_push"); */ + } else { + memcpy(*outbuf, weird_table[i].to, + weird_table[i].len); + (*inbytesleft) -= 2; + (*outbytesleft) -= weird_table[i].len; + (*inbuf) += 2; + (*outbuf) += weird_table[i].len; + done = 1; + break; + } + } + } + if (done) continue; + + (*outbuf)[0] = (*inbuf)[0]; + if ((*inbuf)[1]) ir_count++; + (*inbytesleft) -= 2; + (*outbytesleft) -= 1; + (*inbuf) += 2; + (*outbuf) += 1; + } + + if (*inbytesleft == 1) { + errno = EINVAL; + return -1; + } + + if (*inbytesleft > 1) { + errno = E2BIG; + return -1; + } + + return ir_count; +} + +struct charset_functions weird_functions = {"WEIRD", weird_pull, weird_push}; + +int init_module(void) +{ + smb_register_charset(&weird_functions); + return 0; +} -- cgit From 3653187a0571a97e4c54e2ee4dd8c0c7e21e487f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 19:27:33 +0000 Subject: Add debug2html and *.so (This used to be commit 2134e3b89726b97ad8b8c6fd3255d6b425144c88) --- source3/bin/.cvsignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/bin/.cvsignore b/source3/bin/.cvsignore index 6a4d52da31d..741838a31e7 100644 --- a/source3/bin/.cvsignore +++ b/source3/bin/.cvsignore @@ -41,3 +41,5 @@ winbindd wrepld vfstest samtest +debug2html +*.so -- cgit From 97bec3fc3e676e088ea78ba81ea02cb4f9434edb Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 20:38:56 +0000 Subject: Remove obsolete scripts and put in module install/uninstall (This used to be commit d777bba5082ebdf78d314b0d7b4196a4d6413e1f) --- source3/script/installcp.sh | 44 ------------------ source3/script/installmodules.sh | 26 +++++++++++ source3/script/makeyodldocs.sh | 92 -------------------------------------- source3/script/uninstallbin.sh | 4 +- source3/script/uninstallcp.sh | 33 -------------- source3/script/uninstallmodules.sh | 37 +++++++++++++++ 6 files changed, 65 insertions(+), 171 deletions(-) delete mode 100755 source3/script/installcp.sh create mode 100755 source3/script/installmodules.sh delete mode 100755 source3/script/makeyodldocs.sh delete mode 100755 source3/script/uninstallcp.sh create mode 100755 source3/script/uninstallmodules.sh diff --git a/source3/script/installcp.sh b/source3/script/installcp.sh deleted file mode 100755 index d0c5bf8ecc9..00000000000 --- a/source3/script/installcp.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -srcdir=$1 -LIBDIR=$2 -CODEPAGEDIR=$3 -BINDIR=$4 - -shift -shift -shift -shift - -echo Installing codepage files in $CODEPAGEDIR -for d in $LIBDIR $CODEPAGEDIR; do -if [ ! -d $d ]; then -mkdir $d -if [ ! -d $d ]; then - echo Failed to make directory $d - exit 1 -fi -fi -done - -for p in $*; do - if [ -f ${srcdir}/codepages/codepage_def.$p ]; then - echo Creating codepage file $CODEPAGEDIR/codepage.$p - $BINDIR/make_smbcodepage c $p ${srcdir}/codepages/codepage_def.$p $CODEPAGEDIR/codepage.$p - fi - if [ -f ${srcdir}/codepages/CP${p}.TXT ]; then - echo Creating unicode map $CODEPAGEDIR/unicode_map.$p - $BINDIR/make_unicodemap $p ${srcdir}/codepages/CP${p}.TXT $CODEPAGEDIR/unicode_map.$p - fi -done - - -cat << EOF -====================================================================== -The code pages have been installed. You may uninstall them using the -command "make uninstallcp" or make "uninstall" to uninstall binaries, -man pages, shell scripts and code pages. -====================================================================== -EOF - -exit 0 - diff --git a/source3/script/installmodules.sh b/source3/script/installmodules.sh new file mode 100755 index 00000000000..9b9d950ca2f --- /dev/null +++ b/source3/script/installmodules.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +INSTALLPERMS=$1 +BASEDIR=$2 +LIBDIR=$3 +shift +shift +shift + +for p in $*; do + p2=`basename $p` + echo Installing $p as $LIBDIR/$p2 + cp -f $p $LIBDIR/ + chmod $INSTALLPERMS $LIBDIR/$p2 +done + + +cat << EOF +====================================================================== +The modules are installed. You may uninstall the modules using the +command "make uninstallmodules" or "make uninstall" to uninstall +binaries, man pages, shell scripts and modules. +====================================================================== +EOF + +exit 0 diff --git a/source3/script/makeyodldocs.sh b/source3/script/makeyodldocs.sh deleted file mode 100755 index 5b54df033e5..00000000000 --- a/source3/script/makeyodldocs.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh -SRCDIR=$1 -shift -FILES=$@ - -if test -z $FILES; then - FILES=*.yo -fi - -YODLDIR=$SRCDIR/../docs/yodldocs -MANPAGEDIR=$SRCDIR/../docs/manpages -HTMLDIR=$SRCDIR/../docs/htmldocs - -echo "Re-creating man pages and HTML pages from YODL sources..." - -if [ ! -d $MANPAGEDIR ]; then - echo "directory $MANPAGEDIR does not exist, are we in the right place?" - exit 1 -fi - -if [ ! -d $HTMLDIR ]; then - echo "directory $HTMLDIR does not exist, are we in the right place?" - exit 1 -fi - -if [ ! -d $YODLDIR ]; then - echo "directory $YODLDIR does not exist, are we in the right place?" - exit 1 -fi - -cd $YODLDIR - -for d in $FILES -do - -# -# Create the basename from the YODL manpage -# - bn=`echo $d | sed -e 's/\.yo//'` - - case "$d" - in - *.[0-9].yo) - echo "Creating man pages..." - echo $d - rm -f $bn.man - yodl2man $d - if [ ! -f $bn.man ]; then - echo "Failed to make man page for $d" - exit 1 - fi - cp $bn.man ../manpages/$bn || echo "Cannot create $YODLDIR/../manpages/$bn" - rm -f $bn.man - - echo "Creating html versions of man pages..." - echo $d - rm -f $bn.html - yodl2html $d - if [ ! -f $bn.html ]; then - echo "Failed to make html page for $d" - exit 1 - fi - cp $bn.html ../htmldocs || echo "Cannot create $YODLDIR/../htmldocs/$bn.html" - rm -f $bn.html - ;; - *) -# -# Non man-page YODL docs - just make html and text. -# - echo $d - rm -f $bn.html - yodl2html $d - if [ ! -f $bn.html ]; then - echo "Failed to make html page for $d" - exit 1 - fi - cp $bn.html ../htmldocs || echo "Cannot create $YODLDIR/../htmldocs/$bn.html" - rm -f $bn.html - rm -f $bn.txt - yodl2txt $d - if [ ! -f $bn.txt ]; then - echo "Failed to make text page for $d" - exit 1 - fi - cp $bn.txt ../textdocs || echo "Cannot create $YODLDIR/../textdocs/$bn.txt" - rm -f $bn.txt - ;; - esac -done - -echo "Remember to CVS check in your changes..." -exit 0 diff --git a/source3/script/uninstallbin.sh b/source3/script/uninstallbin.sh index 53775f89465..a8bbdea7afd 100755 --- a/source3/script/uninstallbin.sh +++ b/source3/script/uninstallbin.sh @@ -34,8 +34,8 @@ cat << EOF ====================================================================== The binaries have been uninstalled. You may restore the binaries using the command "make installbin" or "make install" to install binaries, -man pages and shell scripts. You can restore a previous version of the -binaries (if there were any) using "make revert". +man pages, modules and shell scripts. You can restore a previous +version of the binaries (if there were any) using "make revert". ====================================================================== EOF diff --git a/source3/script/uninstallcp.sh b/source3/script/uninstallcp.sh deleted file mode 100755 index 2a9e9d509ab..00000000000 --- a/source3/script/uninstallcp.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -CPDIR=$1 -shift - -if [ ! -d $CPDIR ]; then - echo Directory $CPDIR does not exist! - echo Do a "make installcp" or "make install" first. - exit 1 -fi - -for p in $*; do - if [ ! -f $CPDIR/unicode_map.$p ]; then - echo $CPDIR/unicode_map.$p does not exist! - else - echo Removing $CPDIR/unicode_map.$p - rm -f $CPDIR/unicode_map.$p - if [ -f $CPDIR/unicode_map.$p ]; then - echo Cannot remove $CPDIR/unicode_map.$p... does $USER have privileges? - fi - fi -done - -cat << EOF -====================================================================== -The code pages have been uninstalled. You may reinstall them using -the command "make installcp" or "make install" to install binaries, -man pages, shell scripts and code pages. You may recover a previous version -(if any with "make revert"). -====================================================================== -EOF - -exit 0 diff --git a/source3/script/uninstallmodules.sh b/source3/script/uninstallmodules.sh new file mode 100755 index 00000000000..30582a39fac --- /dev/null +++ b/source3/script/uninstallmodules.sh @@ -0,0 +1,37 @@ +#!/bin/sh +#4 July 96 Dan.Shearer@UniSA.edu.au + +INSTALLPERMS=$1 +BASEDIR=$2 +LIBDIR=$3 +shift +shift +shift + +if [ ! -d $LIBDIR ]; then + echo Directory $LIBDIR does not exist! + echo Do a "make installmodules" or "make install" first. + exit 1 +fi + +for p in $*; do + p2=`basename $p` + if [ -f $LIBDIR/$p2 ]; then + echo Removing $LIBDIR/$p2 + rm -f $LIBDIR/$p2 + if [ -f $LIBDIR/$p2 ]; then + echo Cannot remove $LIBDIR/$p2 ... does $USER have privileges? + fi + fi +done + + +cat << EOF +====================================================================== +The modules have been uninstalled. You may restore the modules using +the command "make installmodules" or "make install" to install +binaries, modules, man pages and shell scripts. +====================================================================== +EOF + +exit 0 -- cgit From 89d6a36b8594fa7cfab082b0d4eb93caed0fdeae Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 20:40:31 +0000 Subject: Add installmodules and uninstallmodules targets (This used to be commit c656e7dce91bb3171f9ec2b8d8f98812ab6c618f) --- source3/Makefile.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index af14c6a9f83..ab195546bb8 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -116,7 +116,7 @@ SCRIPTS = $(srcdir)/script/smbtar $(srcdir)/script/addtosmbpass $(srcdir)/script QUOTAOBJS=@QUOTAOBJS@ -MODULES = bin/vfs_audit.so bin/vfs_recycle.so bin/vfs_netatalk.so bin/developer.so @MODULE_PDB_MYSQL@ @MODULE_PDB_XML@ +MODULES = bin/vfs_audit.@SHLIBEXT@ bin/vfs_recycle.@SHLIBEXT@ bin/vfs_netatalk.@SHLIBEXT@ bin/developer.@SHLIBEXT@ @MODULE_PDB_MYSQL@ @MODULE_PDB_XML@ ###################################################################### # object file lists @@ -880,6 +880,9 @@ installbin: all installdirs @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SPROGS) @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(PROGS) +installmodules: all installdirs + @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(LIBDIR) $(MODULES) + installscripts: installdirs @$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS) @@ -976,6 +979,9 @@ uninstallbin: @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SPROGS) @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PROGS) +uninstallmodules: + @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(MODULES) + uninstallscripts: @$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS) -- cgit From 38c6b90bf8b288426779f3eedcfd643c65a07ef7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 13 Nov 2002 21:47:21 +0000 Subject: Fix smbwrapper from the global_* changes. Jeremy. (This used to be commit 6ab12ca80d12fcecf6ad3a534bd73b482d991112) --- source3/smbwrapper/smbsh.c | 2 +- source3/smbwrapper/smbw.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/smbwrapper/smbsh.c b/source3/smbwrapper/smbsh.c index 0d705ddcfaa..f9697223c4d 100644 --- a/source3/smbwrapper/smbsh.c +++ b/source3/smbwrapper/smbsh.c @@ -36,7 +36,7 @@ static void smbsh_usage(void) int main(int argc, char *argv[]) { char *p, *u; - char *libd = dyn_BINDIR; + const char *libd = dyn_BINDIR; pstring line, wd; int opt; extern char *optarg; diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index 2dd7c4ea6dd..005d9af53f5 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -27,7 +27,6 @@ static struct smbw_file *smbw_files; static struct smbw_server *smbw_srvs; struct bitmap *smbw_file_bmap; -extern pstring global_myname; fstring smbw_prefix = SMBW_PREFIX; @@ -79,7 +78,8 @@ void smbw_init(void) lp_load(dyn_CONFIGFILE,True,False,False); - get_myname(global_myname); + if (!init_names()) + exit(1); if ((p=smbw_getshared("DEBUG"))) { DEBUGLEVEL = atoi(p); @@ -461,7 +461,7 @@ struct smbw_server *smbw_server(char *server, char *share) return NULL; } - make_nmb_name(&calling, global_myname, 0x0); + make_nmb_name(&calling, global_myname(), 0x0); make_nmb_name(&called , server, 0x20); DEBUG(4,("server_n=[%s] server=[%s]\n", server_n, server)); -- cgit From 2aaf85730a187556b60085d6b7707e247863565c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Nov 2002 21:51:08 +0000 Subject: small patch to makesure we fallback to if doesn't exist (e.g. in SuSE 8.1) (by metze) (This used to be commit 5f16343e0d7c8120a7a5786097b8920a5b7d047b) --- source3/configure | 114 ++++++++++++++++++++++++++++++++++++++++++++ source3/configure.in | 1 + source3/include/config.h.in | 3 ++ source3/smbd/quotas.c | 5 ++ 4 files changed, 123 insertions(+) diff --git a/source3/configure b/source3/configure index 964b3d5dba9..8d9cdf1060a 100755 --- a/source3/configure +++ b/source3/configure @@ -6120,6 +6120,120 @@ fi done +for ac_header in xfs/xqm.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + echo "$as_me:$LINENO: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6 if test "${ac_cv_type_int+set}" = set; then diff --git a/source3/configure.in b/source3/configure.in index 7818f2f0c6e..9d81975f8c2 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -462,6 +462,7 @@ AC_CHECK_HEADERS(sys/fs/vx_quota.h) # For quotas on Linux XFS filesystems AC_CHECK_HEADERS(linux/xqm.h) +AC_CHECK_HEADERS(xfs/xqm.h) AC_CHECK_SIZEOF(int,cross) AC_CHECK_SIZEOF(long,cross) diff --git a/source3/include/config.h.in b/source3/include/config.h.in index 0895a783d4d..ebcbc6504e9 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -973,6 +973,9 @@ /* Define if you have working AF_LOCAL sockets */ #undef HAVE_WORKING_AF_LOCAL +/* Define to 1 if you have the header file. */ +#undef HAVE_XFS_XQM_H + /* Whether the system has yp_get_default_domain() */ #undef HAVE_YP_GET_DEFAULT_DOMAIN diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c index 39cb8f2432f..90fd4bbdac0 100644 --- a/source3/smbd/quotas.c +++ b/source3/smbd/quotas.c @@ -56,6 +56,11 @@ BOOL disk_quotas_vxfs(const pstring name, char *path, SMB_BIG_UINT *bsize, SMB_B #include #ifdef HAVE_LINUX_XQM_H #include +#else +#ifdef HAVE_XFS_XQM_H +#include +#define HAVE_LINUX_XQM_H +#endif #endif #include -- cgit From 1237ae89c6cdc050181c10a509c61b4ebcb90ff5 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 14 Nov 2002 00:53:40 +0000 Subject: Quieten status message when linking libsmbclient.so (This used to be commit 85946731dd8bc60d0f71fe7ffa6756bd3bcbbf67) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index ab195546bb8..0532b7a228b 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -787,7 +787,7 @@ bin/smbwrapper.32.@SHLIBEXT@: $(PICOBJS32) @SONAMEFLAG@`basename $@` bin/libsmbclient.@SHLIBEXT@: $(LIBSMBCLIENT_PICOBJS) - echo Linking libsmbclient shared library $@ + @echo Linking libsmbclient shared library $@ $(SHLD) $(LDSHFLAGS) -o $@ $(LIBSMBCLIENT_PICOBJS) $(LIBS) \ @SONAMEFLAG@`basename $@`.$(LIBSMBCLIENT_MAJOR) -- cgit From 94c857fe25dcf8c8295779fae4de9dfe7eae446a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 14 Nov 2002 17:37:44 +0000 Subject: Update documentation to cover cascaded VFS modules (This used to be commit 218395ac7e5963a773691fb5a0539cce9e3b92f2) --- docs/docbook/manpages/smb.conf.5.sgml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/docbook/manpages/smb.conf.5.sgml b/docs/docbook/manpages/smb.conf.5.sgml index 0cdf2bbcd60..ca4de18cfd8 100644 --- a/docs/docbook/manpages/smb.conf.5.sgml +++ b/docs/docbook/manpages/smb.conf.5.sgml @@ -2300,7 +2300,7 @@ domain logons (G) If set to yes, the Samba server will serve Windows 95/98 Domain logons for the - workgroup it is in. Samba 2.2 also + workgroup it is in. Samba 2.2 has limited capability to act as a domain controller for Windows NT 4 Domains. For more details on setting up this feature see the Samba-PDC-HOWTO included in the htmldocs/ @@ -3791,7 +3791,7 @@ The value of the parameter (a astring) allows the debug level (logging level) to be specified in the smb.conf file. This parameter has been - extended since 2.2.x series, now it allow to specify the debug + extended since the 2.2.x series, now it allow to specify the debug level for multiple debug classes. This is to give greater flexibility in the configuration of the system. @@ -8055,11 +8055,10 @@ veto files = /.AppleDouble/.bin/.AppleDesktop/Network Trash Folder/ vfs object (S) - This parameter specifies a shared object file that - is used for Samba VFS I/O operations. By default, normal + This parameter specifies a shared object files that + are used for Samba VFS I/O operations. By default, normal disk I/O operations are used but these can be overloaded - with a VFS object. The Samba VFS layer is new to Samba 2.2 and - must be enabled at compile time with --with-vfs. + with one or more VFS objects. Default : no value @@ -8071,9 +8070,8 @@ veto files = /.AppleDouble/.bin/.AppleDesktop/Network Trash Folder/ vfs options (S) This parameter allows parameters to be passed - to the vfs layer at initialization time. The Samba VFS layer - is new to Samba 2.2 and must be enabled at compile time - with --with-vfs. See also + to the vfs layer at initialization time. + See also vfs object. Default : no value -- cgit From 8d2514fc6af47aba535dd95c9a998104cab85ae9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 14 Nov 2002 17:42:01 +0000 Subject: a cups printing backend is now available as well (This used to be commit 4cffb29d27253e0e2ca270640d86b21315cab91f) --- examples/smb.conf.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/smb.conf.default b/examples/smb.conf.default index 417417d256f..d299f017140 100644 --- a/examples/smb.conf.default +++ b/examples/smb.conf.default @@ -41,7 +41,7 @@ # It should not be necessary to specify the print system type unless # it is non-standard. Currently supported print systems include: -# bsd, sysv, plp, lprng, aix, hpux, qnx +# bsd, sysv, plp, lprng, aix, hpux, qnx, cups ; printing = bsd # Uncomment this if you want a guest account, you must add this to /etc/passwd -- cgit From a7e439268742733f23c96875901af49a409cff0c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 14 Nov 2002 18:16:17 +0000 Subject: Remove the #ifdef's for NISPLUS_SAM - there are no function name collisions anymore (This used to be commit f6ef18df11cc48f25adeee464e79e63ee209b08c) --- source3/passdb/pdb_interface.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index edc310c0c1a..88070d8694c 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -522,8 +522,6 @@ static struct pdb_context *pdb_get_static_context(BOOL reload) return pdb_context; } -#if !defined(WITH_NISPLUS_SAM) - /****************************************************************** Backward compatibility functions for the original passdb interface *******************************************************************/ @@ -703,8 +701,6 @@ BOOL pdb_enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, with_priv)); } -#endif /* !defined(WITH_NISPLUS_SAM) */ - /*************************************************************** Initialize the static context (at smbd startup etc). -- cgit From b75212077de08670a449d1f2192aded400559c6e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 14 Nov 2002 21:04:12 +0000 Subject: Update testparm for 3.0 (This used to be commit f01fad02d75975f25235eeeba8262bf11657e54a) --- docs/docbook/manpages/testparm.1.sgml | 12 +++++++++--- docs/docs-status | 3 --- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/docbook/manpages/testparm.1.sgml b/docs/docbook/manpages/testparm.1.sgml index 350683eb574..254ede7265d 100644 --- a/docs/docbook/manpages/testparm.1.sgml +++ b/docs/docbook/manpages/testparm.1.sgml @@ -20,8 +20,9 @@ -h -v -L <servername> + -t <encoding> config filename - hostname hostIP + hostname hostIP @@ -86,6 +87,12 @@ their defaults. + + -t encoding + + Output data in specified encoding. + + configfilename This is the name of the configuration file @@ -144,7 +151,7 @@ VERSION - This man page is correct for version 2.2 of + This man page is correct for version 3.0 of the Samba suite. @@ -173,4 +180,3 @@ - diff --git a/docs/docs-status b/docs/docs-status index 23a0127c3b4..7dc301e9ec5 100644 --- a/docs/docs-status +++ b/docs/docs-status @@ -40,13 +40,10 @@ docs/docbook/manpages/smbstatus.1.sgml docs/docbook/manpages/smbtar.1.sgml docs/docbook/manpages/smbumount.8.sgml docs/docbook/manpages/swat.8.sgml -docs/docbook/manpages/testparm.1.sgml docs/docbook/manpages/testprns.1.sgml Stuff that needs to be documented: Doc for package maintainers -Some kind of introduction to the various terms used (locking, wins, browsing, domain, ... ) -Merge the various docs about wins and browsing Windows NT 4.0 Style Trust Relationship One Time Migration script from a Windows NT 4.0 PDC to a Samba PDC ldap passwd sync -- cgit From 77f45f5e530600d01f57a7fedbaa272ecd2f8c65 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 14 Nov 2002 21:18:22 +0000 Subject: Add more info about stackable VFS objects (This used to be commit 2dcb295d8eceea7e92e7e8f2e2ffc3583db833fd) --- docs/docbook/projdoc/VFS.sgml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/docbook/projdoc/VFS.sgml b/docs/docbook/projdoc/VFS.sgml index 4c228dfa872..66b9be1dbd5 100644 --- a/docs/docbook/projdoc/VFS.sgml +++ b/docs/docbook/projdoc/VFS.sgml @@ -11,7 +11,7 @@ Introduction and configuration -Since samba 3.0, samba supports stackable VFS(Virtual File System) modules. +Since samba 3.0, samba supports stackable VFS(Virtual File System) modules. Samba passes each request to access the unix file system thru the loaded VFS modules. This chapter covers all the modules that come with the samba source and references to some external modules. @@ -20,27 +20,32 @@ some external modules. You may have problems to compile these modules, as shared libraries are compiled and linked in different ways on different systems. -I currently tested them against GNU/linux and IRIX. +They currently have been tested against GNU/linux and IRIX. To use the VFS modules, create a share similar to the one below. The important parameter is the vfs object parameter which must point to -the exact pathname of the shared library object. For example, to use audit.so: +the exact pathname of the shared library objects. For example, to log all access +to files and use a recycle bin: [audit] comment = Audited /data directory path = /data - vfs object = /path/to/audit.so + vfs object = /path/to/audit.so /path/to/recycle.so writeable = yes browseable = yes + +The modules are used in the order they are specified. + + Further documentation on writing VFS modules for Samba can be found in -docs directory of the Samba source distribution. +the Samba Developers Guide. -- cgit From 2b799b56f4d37d2baec44088c096a5a34ac8a968 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 14 Nov 2002 21:36:46 +0000 Subject: Remove some obsolete info (This used to be commit ffd2d3a0ba56f967112aaa63efd4221fad2cee70) --- docs/docbook/projdoc/Speed.sgml | 238 +--------------------------------------- 1 file changed, 2 insertions(+), 236 deletions(-) diff --git a/docs/docbook/projdoc/Speed.sgml b/docs/docbook/projdoc/Speed.sgml index 17adf104291..55d8b9492b2 100644 --- a/docs/docbook/projdoc/Speed.sgml +++ b/docs/docbook/projdoc/Speed.sgml @@ -53,92 +53,6 @@ systems. - -Oplocks - - -Overview - - -Oplocks are the way that SMB clients get permission from a server to -locally cache file operations. If a server grants an oplock -(opportunistic lock) then the client is free to assume that it is the -only one accessing the file and it will agressively cache file -data. With some oplock types the client may even cache file open/close -operations. This can give enormous performance benefits. - - - -With the release of Samba 1.9.18 we now correctly support opportunistic -locks. This is turned on by default, and can be turned off on a share- -by-share basis by setting the parameter : - - - -oplocks = False - - - -We recommend that you leave oplocks on however, as current benchmark -tests with NetBench seem to give approximately a 30% improvement in -speed with them on. This is on average however, and the actual -improvement seen can be orders of magnitude greater, depending on -what the client redirector is doing. - - - -Previous to Samba 1.9.18 there was a 'fake oplocks' option. This -option has been left in the code for backwards compatibility reasons -but it's use is now deprecated. A short summary of what the old -code did follows. - - - - - -Level2 Oplocks - - -With Samba 2.0.5 a new capability - level2 (read only) oplocks is -supported (although the option is off by default - see the smb.conf -man page for details). Turning on level2 oplocks (on a share-by-share basis) -by setting the parameter : - - - -level2 oplocks = true - - - -should speed concurrent access to files that are not commonly written -to, such as application serving shares (ie. shares that contain common -.EXE files - such as a Microsoft Office share) as it allows clients to -read-ahread cache copies of these files. - - - - - -Old 'fake oplocks' option - deprecated - - -Samba can also fake oplocks, by granting a oplock whenever a client -asks for one. This is controlled using the smb.conf option "fake -oplocks". If you set "fake oplocks = yes" then you are telling the -client that it may agressively cache the file data for all opens. - - - -Enabling 'fake oplocks' on all read-only shares or shares that you know -will only be accessed from one client at a time you will see a big -performance improvement on many operations. If you enable this option -on shares where multiple clients may be accessing the files read-write -at the same time you can get data corruption. - - - - - Socket options @@ -226,55 +140,6 @@ In most cases the default is the best option. - -Locking - - -By default Samba does not implement strict locking on each read/write -call (although it did in previous versions). If you enable strict -locking (using "strict locking = yes") then you may find that you -suffer a severe performance hit on some systems. - - - -The performance hit will probably be greater on NFS mounted -filesystems, but could be quite high even on local disks. - - - - - -Share modes - - -Some people find that opening files is very slow. This is often -because of the "share modes" code needed to fully implement the dos -share modes stuff. You can disable this code using "share modes = -no". This will gain you a lot in opening and closing files but will -mean that (in some cases) the system won't force a second user of a -file to open the file read-only if the first has it open -read-write. For many applications that do their own locking this -doesn't matter, but for some it may. Most Windows applications -depend heavily on "share modes" working correctly and it is -recommended that the Samba share mode support be left at the -default of "on". - - - -The share mode code in Samba has been re-written in the 1.9.17 -release following tests with the Ziff-Davis NetBench PC Benchmarking -tool. It is now believed that Samba 1.9.17 implements share modes -similarly to Windows NT. - - - -NOTE: In the most recent versions of Samba there is an option to use -shared memory via mmap() to implement the share modes. This makes -things much faster. See the Makefile for how to enable this. - - - - Log level @@ -286,18 +151,6 @@ expensive. - -Wide lines - - -The "wide links" option is now enabled by default, but if you disable -it (for better security) then you may suffer a performance hit in -resolving filenames. The performance loss is lessened if you have -"getwd cache = yes", which is now the default. - - - - Read raw @@ -339,61 +192,6 @@ case you may wish to change this option. - -Read prediction - - -Samba can do read prediction on some of the SMB commands. Read -prediction means that Samba reads some extra data on the last file it -read while waiting for the next SMB command to arrive. It can then -respond more quickly when the next read request arrives. - - - -This is disabled by default. You can enable it by using "read -prediction = yes". - - - -Note that read prediction is only used on files that were opened read -only. - - - -Read prediction should particularly help for those silly clients (such -as "Write" under NT) which do lots of very small reads on a file. - - - -Samba will not read ahead more data than the amount specified in the -"read size" option. It always reads ahead on 1k block boundaries. - - - - - -Memory mapping - - -Samba supports reading files via memory mapping them. One some -machines this can give a large boost to performance, on others it -makes not difference at all, and on some it may reduce performance. - - - -To enable you you have to recompile Samba with the -DUSE_MMAP option -on the FLAGS line of the Makefile. - - - -Note that memory mapping is only used on files opened read only, and -is not used by the "read raw" operation. Thus you may find memory -mapping is more effective if you disable "read raw" using "read raw = -no". - - - - Slow Clients @@ -510,11 +308,12 @@ drive (Kernel 2.0.30). The transfer rate was reasonable for 10 baseT. -FIXME + The figures are: Put Get P166 client 3Com card: 420-440kB/s 500-520kB/s P100 client 3Com card: 390-410kB/s 490-510kB/s DX4-75 client NE2000: 370-380kB/s 330-350kB/s + @@ -541,38 +340,5 @@ if it could get up to the rate of FTP the perfomance would be quite staggering. - - - -My Results - - -Some people want to see real numbers in a document like this, so here -they are. I have a 486sx33 client running WfWg 3.11 with the 3.11b -tcp/ip stack. It has a slow IDE drive and 20Mb of ram. It has a SMC -Elite-16 ISA bus ethernet card. The only WfWg tuning I've done is to -set DefaultRcvWindow in the [MSTCP] section of system.ini to 16384. My -server is a 486dx3-66 running Linux. It also has 20Mb of ram and a SMC -Elite-16 card. You can see my server config in the examples/tridge/ -subdirectory of the distribution. - - - -I get 490k/s on reading a 8Mb file with copy. -I get 441k/s writing the same file to the samba server. - - - -Of course, there's a lot more to benchmarks than 2 raw throughput -figures, but it gives you a ballpark figure. - - - -I've also tested Win95 and WinNT, and found WinNT gave me the best -speed as a samba client. The fastest client of all (for me) is -smbclient running on another linux box. Maybe I'll add those results -here someday ... - - -- cgit From ae23dfd427bc69b747e20f2217163cb863aa2c71 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 14 Nov 2002 22:54:23 +0000 Subject: Some small updates - 'ads server' is no longer required for example (This used to be commit b8f9930f62db8b997a0d6126e79212a113f8b29c) --- docs/docbook/projdoc/ADS-HOWTO.sgml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/docbook/projdoc/ADS-HOWTO.sgml b/docs/docbook/projdoc/ADS-HOWTO.sgml index 83bb2dc85d3..3e34d53c0af 100644 --- a/docs/docbook/projdoc/ADS-HOWTO.sgml +++ b/docs/docbook/projdoc/ADS-HOWTO.sgml @@ -10,10 +10,8 @@ Samba as a ADS domain member -This is a VERY ROUGH guide to setting up the current (November 2001) -pre-alpha version of Samba 3.0 with kerberos authentication against a -Windows2000 KDC. The procedures listed here are likely to change as -the code develops. +This is a rough guide to setting up Samba 3.0 with kerberos authentication against a +Windows2000 KDC. Pieces you need before you begin: @@ -76,13 +74,17 @@ to get them off CD2. realm = YOUR.KERBEROS.REALM - ads server = your.kerberos.server security = ADS encrypt passwords = yes -Strictly speaking, you can omit the realm name and you can use an IP - address for the ads server. In that case Samba will auto-detect these. + +In case samba can't figure out your ads server using your realm name, use the +ads server option in smb.conf: + + ads server = your.kerberos.server + + You do *not* need a smbpasswd file, although it won't do any harm and if you have one then Samba will be able to fall back to normal -- cgit From e0d81b77287da51f9efc83e0c32a7d8d298d720c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 15 Nov 2002 00:20:55 +0000 Subject: A cool idea from mbp: create a big shared library of all Samba objects which we can use to link against Samba unit test programs. Now we can compile and link unit tests without having to create 4MB executables for each program It's called libbigballofmud.so both to discourage casual usage and also to reflect what the dependencies within Samba have become. (This used to be commit fdce4be719d7a81f25a4bae05934a5590038ec47) --- source3/rpc_client/cli_pipe.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 90f08148ef4..632dd30c3a8 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -844,7 +844,7 @@ BOOL rpc_api_pipe_req(struct cli_state *cli, uint8 op_num, uint32 data_len, send_size; uint8 flags = 0; uint32 crc32 = 0; - uint32 callid; + uint32 callid = 0; /* * how much will we send this time @@ -862,10 +862,9 @@ BOOL rpc_api_pipe_req(struct cli_state *cli, uint8 op_num, return False; } - if (data_left == prs_offset(data)) { + if (data_left == prs_offset(data)) flags |= RPC_FLG_FIRST; - callid = 0; - } + if (data_left < max_data) flags |= RPC_FLG_LAST; /* -- cgit From 6c0dafc0c020826be770116e170c2c67b260c769 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 15 Nov 2002 00:33:55 +0000 Subject: A cool idea from mbp: create a big shared library of all Samba objects which we can use to link against Samba unit test programs. Now we can compile and link unit tests without having to create 4MB executables for each program It's called libbigballofmud.so both to discourage casual usage and also to reflect what the dependencies within Samba have become. (This used to be commit a59f731256f3a1c09f32452de9483b44088c942b) --- source3/Makefile.in | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 0532b7a228b..c82eb5dad3d 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -385,6 +385,18 @@ LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o libsmb/libsmb_compat.o \ libsmb/libsmb_cache.o $(LIB_OBJ) \ $(LIBSMB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ) +# This shared library is intended for linking with unit test programs +# to test Samba internals. It's called libbigballofmud.so to +# discourage casual usage. + +LIBBIGBALLOFMUD_MAJOR = 0 + +LIBBIGBALLOFMUD_OBJ = $(LIB_OBJ) $(UBIQX_OBJ) $(PARAM_OBJ) $(SECRETS_OBJ) \ + $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_OBJ) \ + $(GROUPDB_OBJ) + +LIBBIGBALLOFMUD_PICOBJS = $(LIBBIGBALLOFMUD_OBJ:.o=.po) + CLIENT_OBJ1 = client/client.o client/clitar.o CLIENT_OBJ = $(CLIENT_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \ @@ -795,6 +807,11 @@ bin/libsmbclient.a: $(LIBSMBCLIENT_PICOBJS) @echo Linking libsmbclient non-shared library $@ -$(AR) -rc $@ $(LIBSMBCLIENT_PICOBJS) +bin/libbigballofmud.@SHLIBEXT@: $(LIBBIGBALLOFMUD_PICOBJS) + @echo Linking bigballofmud shared library $@ + $(SHLD) $(LDSHFLAGS) -o $@ $(LIBBIGBALLOFMUD_PICOBJS) $(LIBS) \ + @SONAMEFLAG@`basename $@`.$(LIBBIGBALLOFMUD_MAJOR) + libsmbclient: bin/libsmbclient.a bin/libsmbclient.@SHLIBEXT@ nsswitch/libnss_wins.@SHLIBEXT@: $(NSS_OBJ) @@ -1124,4 +1141,3 @@ dangerous-installcheck: SATYR_SUITEDIR=../testsuite/satyr/ prefix=$(BASEDIR) \ LIBSMB_PROG=$(SBINDIR)/smbd \ testdir=./testdir $(SHELL) satyr - -- cgit From 3b06627f00ba4621011383e0fab0b0ba5d4e4645 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 15 Nov 2002 13:53:02 +0000 Subject: Updates to the build farm tests: - Get valid/invalid users working - Test preexec, preexec close Andrew Bartlett (This used to be commit 36441899e61a711b8fe03ec7b6f95973b1e69fc5) --- testsuite/build_farm/basicsmb-invalidusers.test | 2 ++ testsuite/build_farm/basicsmb-preexec.test | 28 ++++++++++++++++++++++ testsuite/build_farm/basicsmb.fns | 24 +++++++++++++++---- .../build_farm/basicsmb.smb.conf.preexec.template | 1 + .../basicsmb.smb.conf.preexec_cl_fail.template | 2 ++ .../basicsmb.smb.conf.preexec_close.template | 2 ++ .../basicsmb.smb.conf.validusers.template | 1 + testsuite/build_farm/preexec.template | 2 ++ testsuite/build_farm/runlist | 1 + 9 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 testsuite/build_farm/basicsmb-preexec.test create mode 100644 testsuite/build_farm/basicsmb.smb.conf.preexec.template create mode 100644 testsuite/build_farm/basicsmb.smb.conf.preexec_cl_fail.template create mode 100644 testsuite/build_farm/basicsmb.smb.conf.preexec_close.template create mode 100644 testsuite/build_farm/basicsmb.smb.conf.validusers.template create mode 100644 testsuite/build_farm/preexec.template diff --git a/testsuite/build_farm/basicsmb-invalidusers.test b/testsuite/build_farm/basicsmb-invalidusers.test index 54c9c758c69..7d67cc2fc71 100644 --- a/testsuite/build_farm/basicsmb-invalidusers.test +++ b/testsuite/build_farm/basicsmb-invalidusers.test @@ -6,3 +6,5 @@ security="invalidusers" (test_listfilesauth_should_deny $security) || exit 1 +security="validusers" +(test_listfilesauth $security) || exit 1 diff --git a/testsuite/build_farm/basicsmb-preexec.test b/testsuite/build_farm/basicsmb-preexec.test new file mode 100644 index 00000000000..bc87723700f --- /dev/null +++ b/testsuite/build_farm/basicsmb-preexec.test @@ -0,0 +1,28 @@ +. basicsmb.fns + +password=samba +(test_smb_conf_setup && test_smbpasswd $password ) || exit 1 + +rm -f $prefix/testdir/preexec_touch + +mode=PREEXEC +(test_listfilesauth $mode) || exit 1 + +if [ -f $prefix/testdir/preexec_touch ]; then + rm -f $prefix/testdir/preexec_touch +else + exit 1; +fi + +mode=PREEXEC_close +(test_listfilesauth $mode) || exit 1 + +if [ -f $prefix/testdir/preexec_touch ]; then + rm -f $prefix/testdir/preexec_touch +else + exit 1; +fi + +mode=PREEXEC_cl_fail +(test_listfilesauth_should_deny $mode) || exit 1 + diff --git a/testsuite/build_farm/basicsmb.fns b/testsuite/build_farm/basicsmb.fns index 5a41b8bd9da..bb177704ef3 100644 --- a/testsuite/build_farm/basicsmb.fns +++ b/testsuite/build_farm/basicsmb.fns @@ -21,14 +21,18 @@ # directory when testing. Some of them take a -c parameter, but tpot # says it's not done consistently. -template_smb_conf_setup() { - cat basicsmb.smb.conf$1.template | \ +template_setup() { + cat $1.template | \ sed "s|PREFIX|$prefix|g" | \ sed "s|BUILD_FARM|$test_root|g" | \ sed "s|WHOAMI|$whoami|g" | \ sed "s|LOGLEVEL|$loglevel|g" \ - > $prefix/lib/smb.conf$1 - echo "template_smb_conf_setup: Created $prefix/lib/smb.conf$1" + > $prefix/$2 + echo "template_setup: Created $prefix/$2" +} + +template_smb_conf_setup() { + template_setup "basicsmb.smb.conf$1" "lib/smb.conf$1" } test_smb_conf_setup() { @@ -50,7 +54,13 @@ test_smb_conf_setup() { template_smb_conf_setup template_smb_conf_setup .hostsequiv + template_smb_conf_setup .validusers template_smb_conf_setup .invalidusers + template_smb_conf_setup .preexec + template_smb_conf_setup .preexec_close + template_smb_conf_setup .preexec_cl_fail + + template_setup preexec lib/preexec echo "127.0.0.1 localhost">$prefix/lib/lmhosts echo "127.0.0.2 BUILDFARM">>$prefix/lib/lmhosts @@ -59,6 +69,12 @@ test_smb_conf_setup() { echo "127.0.0.5 SERVER">>$prefix/lib/lmhosts echo "127.0.0.6 DOMAIN">>$prefix/lib/lmhosts echo "127.0.0.7 HOSTSEQUIV">>$prefix/lib/lmhosts + echo "127.0.0.7 VALIDUSERS">>$prefix/lib/lmhosts + echo "127.0.0.7 INVALIDUSERS">>$prefix/lib/lmhosts + echo "127.0.0.7 PREEXEC">>$prefix/lib/lmhosts + echo "127.0.0.7 PREEXEC_CLOSE">>$prefix/lib/lmhosts + echo "127.0.0.7 PREEXEC_CL_FAIL">>$prefix/lib/lmhosts + echo "127.0.0.1" > $prefix/lib/hosts.equiv diff --git a/testsuite/build_farm/basicsmb.smb.conf.preexec.template b/testsuite/build_farm/basicsmb.smb.conf.preexec.template new file mode 100644 index 00000000000..cc34872c5df --- /dev/null +++ b/testsuite/build_farm/basicsmb.smb.conf.preexec.template @@ -0,0 +1 @@ +preexec = /bin/sh PREFIX/lib/preexec diff --git a/testsuite/build_farm/basicsmb.smb.conf.preexec_cl_fail.template b/testsuite/build_farm/basicsmb.smb.conf.preexec_cl_fail.template new file mode 100644 index 00000000000..5578e7110e1 --- /dev/null +++ b/testsuite/build_farm/basicsmb.smb.conf.preexec_cl_fail.template @@ -0,0 +1,2 @@ +preexec close = yes +preexec = /bin/sh PREFIX/lib/preexec_does_not_exist \ No newline at end of file diff --git a/testsuite/build_farm/basicsmb.smb.conf.preexec_close.template b/testsuite/build_farm/basicsmb.smb.conf.preexec_close.template new file mode 100644 index 00000000000..3aac6998bfc --- /dev/null +++ b/testsuite/build_farm/basicsmb.smb.conf.preexec_close.template @@ -0,0 +1,2 @@ +preexec close = yes +preexec = /bin/sh PREFIX/lib/preexec diff --git a/testsuite/build_farm/basicsmb.smb.conf.validusers.template b/testsuite/build_farm/basicsmb.smb.conf.validusers.template new file mode 100644 index 00000000000..d4a85e0a028 --- /dev/null +++ b/testsuite/build_farm/basicsmb.smb.conf.validusers.template @@ -0,0 +1 @@ + valid users = WHOAMI diff --git a/testsuite/build_farm/preexec.template b/testsuite/build_farm/preexec.template new file mode 100644 index 00000000000..e417d6a0170 --- /dev/null +++ b/testsuite/build_farm/preexec.template @@ -0,0 +1,2 @@ +#!/bin/sh +echo "Test worked" > PREFIX/testdir/preexec_touch diff --git a/testsuite/build_farm/runlist b/testsuite/build_farm/runlist index a7d4808bc3a..bdf92f8712d 100644 --- a/testsuite/build_farm/runlist +++ b/testsuite/build_farm/runlist @@ -3,6 +3,7 @@ basicsmb-sharesec basicsmb-usersec \ basicsmb-serversec basicsmb-domainsec basicsmb-domainsec-nt4 \ basicsmb-shareguest basicsmb-hostsequiv basicsmb-invalidusers \ basicsmb-hostsdeny basicsmb-remote-pass-change \ +basicsmb-preexec \ torture-FDPASS torture-LOCK1 torture-LOCK2 \ torture-LOCK3 torture-LOCK4 torture-LOCK5 \ torture-UNLINK torture-BROWSE torture-ATTR \ -- cgit