diff options
-rwxr-xr-x | source3/configure | 2 | ||||
-rw-r--r-- | source3/configure.in | 2 | ||||
-rw-r--r-- | source3/include/config.h.in | 3 | ||||
-rw-r--r-- | source3/include/debug.h | 17 | ||||
-rw-r--r-- | source3/include/includes.h | 15 | ||||
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/include/rpc_client_proto.h | 231 | ||||
-rw-r--r-- | source3/include/safe_string.h | 5 | ||||
-rw-r--r-- | source3/include/smb.h | 20 | ||||
-rw-r--r-- | source3/lib/debug.c | 42 | ||||
-rw-r--r-- | source3/lib/slprintf.c | 71 | ||||
-rw-r--r-- | source3/lib/snprintf.c | 26 | ||||
-rw-r--r-- | source3/script/mkproto.awk | 4 | ||||
-rw-r--r-- | source3/smbd/lanman.c | 12 |
14 files changed, 273 insertions, 178 deletions
diff --git a/source3/configure b/source3/configure index cbdd7ee50e..41dc1e094d 100755 --- a/source3/configure +++ b/source3/configure @@ -5235,7 +5235,7 @@ else fi done -for ac_func in memmove vsnprintf snprintf asprintf setsid glob strpbrk pipe crypt16 getauthuid +for ac_func in memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:5242: checking for $ac_func" >&5 diff --git a/source3/configure.in b/source3/configure.in index c6f1b29e72..e65d89ef4b 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -490,7 +490,7 @@ fi AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot) AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset) -AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf setsid glob strpbrk pipe crypt16 getauthuid) +AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid) AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent) AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf) AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64) diff --git a/source3/include/config.h.in b/source3/include/config.h.in index cf1db393c3..5904cece6d 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -723,6 +723,9 @@ /* Define if you have the utimes function. */ #undef HAVE_UTIMES +/* Define if you have the vasprintf function. */ +#undef HAVE_VASPRINTF + /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF diff --git a/source3/include/debug.h b/source3/include/debug.h index d2c3b1d37e..240da0d6fc 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -37,21 +37,8 @@ arguemnts to DEBUG() right. We have got them wrong too often in the past. */ -#ifdef HAVE_STDARG_H -int Debug1( char *, ... ) -#ifdef __GNUC__ - __attribute__ ((format (__printf__, 1, 2))) -#endif -; -BOOL dbgtext( char *, ... ) -#ifdef __GNUC__ - __attribute__ ((format (__printf__, 1, 2))) -#endif -; -#else -int Debug1(); -BOOL dbgtext(); -#endif +int Debug1( char *, ... ) PRINTF_ATTRIBUTE(1,2); +BOOL dbgtext( char *, ... ) PRINTF_ATTRIBUTE(1,2); /* If we have these macros, we can add additional info to the header. */ #ifdef HAVE_FILE_MACRO diff --git a/source3/include/includes.h b/source3/include/includes.h index f27d2f564f..a5fa555058 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -994,5 +994,20 @@ extern int DEBUGLEVEL; #define RTLD_NOW 0 #endif +/* add varargs prototypes with printf checking */ +#ifdef __GNUC__ +#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) +#else +#define PRINTF_ATTRIBUTE(a1, a2) +#endif + +int fdprintf(int , char *, ...) PRINTF_ATTRIBUTE(2,3); +#ifndef HAVE_SNPRINTF +int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4); +#endif +#ifndef HAVE_ASPRINTF +int asprintf(char **,char *, ...) PRINTF_ATTRIBUTE(2,3); +#endif + #endif /* _INCLUDES_H */ diff --git a/source3/include/proto.h b/source3/include/proto.h index 33aac50332..62f8df2b03 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4502,6 +4502,7 @@ int tdb_clear_spinlocks(TDB_CONTEXT *tdb); /*The following definitions come from tdb/tdb.c */ void tdb_printfreelist(TDB_CONTEXT *tdb); +enum TDB_ERROR tdb_error(TDB_CONTEXT *tdb); const char *tdb_errorstr(TDB_CONTEXT *tdb); TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key); int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key); diff --git a/source3/include/rpc_client_proto.h b/source3/include/rpc_client_proto.h new file mode 100644 index 0000000000..0ecb195691 --- /dev/null +++ b/source3/include/rpc_client_proto.h @@ -0,0 +1,231 @@ +#ifndef _RPC_CLIENT_PROTO_H_ +#define _RPC_CLIENT_PROTO_H_ +/* This file is automatically generated with "make proto". DO NOT EDIT */ + + +/*The following definitions come from lib/util_list.c */ + +BOOL copy_policy_hnd (POLICY_HND *dest, const POLICY_HND *src); +BOOL compare_rpc_hnd_node(const RPC_HND_NODE *x, + const RPC_HND_NODE *y); +BOOL RpcHndList_set_connection(const POLICY_HND *hnd, + struct cli_connection *con); +BOOL RpcHndList_del_connection(const POLICY_HND *hnd); +struct cli_connection* RpcHndList_get_connection(const POLICY_HND *hnd); + +/*The following definitions come from rpc_client/cli_connect.c */ + +void init_connections(void); +void free_connections(void); +void cli_connection_free(struct cli_connection *con); +void cli_connection_unlink(struct cli_connection *con); +BOOL cli_connection_init(const char *srv_name, char *pipe_name, + struct cli_connection **con); +BOOL cli_connection_init_auth(const char *srv_name, char *pipe_name, + struct cli_connection **con, + cli_auth_fns * auth, void *auth_creds); +struct _cli_auth_fns *cli_conn_get_authfns(struct cli_connection *con); +void *cli_conn_get_auth_creds(struct cli_connection *con); +BOOL rpc_hnd_pipe_req(const POLICY_HND * hnd, uint8 op_num, + prs_struct * data, prs_struct * rdata); +BOOL rpc_con_pipe_req(struct cli_connection *con, uint8 op_num, + prs_struct * data, prs_struct * rdata); +BOOL rpc_con_ok(struct cli_connection *con); + +/*The following definitions come from rpc_client/cli_login.c */ + +BOOL cli_nt_setup_creds(struct cli_state *cli, unsigned char mach_pwd[16]); +BOOL cli_nt_srv_pwset(struct cli_state *cli, unsigned char *new_hashof_mach_pwd); +BOOL cli_nt_login_interactive(struct cli_state *cli, char *domain, char *username, + uint32 smb_userid_low, char *password, + NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3); +BOOL cli_nt_login_network(struct cli_state *cli, char *domain, char *username, + uint32 smb_userid_low, char lm_chal[8], + char *lm_chal_resp, char *nt_chal_resp, + NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3); +BOOL cli_nt_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr); + +/*The following definitions come from rpc_client/cli_lsarpc.c */ + +BOOL do_lsa_open_policy(struct cli_state *cli, + char *system_name, POLICY_HND *hnd, + BOOL sec_qos); +BOOL do_lsa_query_info_pol(struct cli_state *cli, + POLICY_HND *hnd, uint16 info_class, + fstring domain_name, DOM_SID *domain_sid); +BOOL do_lsa_close(struct cli_state *cli, POLICY_HND *hnd); +BOOL cli_lsa_get_domain_sid(struct cli_state *cli, char *server); +uint32 lsa_open_policy(const char *system_name, POLICY_HND *hnd, + BOOL sec_qos, uint32 des_access); +uint32 lsa_lookup_sids(POLICY_HND *hnd, int num_sids, DOM_SID *sids, + char ***names, uint32 **types, int *num_names); +uint32 lsa_lookup_names(POLICY_HND *hnd, int num_names, char **names, + DOM_SID **sids, uint32 **types, int *num_sids); + +/*The following definitions come from rpc_client/cli_netlogon.c */ + +BOOL cli_net_logon_ctrl2(struct cli_state *cli, uint32 status_level); +BOOL cli_net_auth2(struct cli_state *cli, uint16 sec_chan, + uint32 neg_flags, DOM_CHAL *srv_chal); +BOOL cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal); +BOOL cli_net_srv_pwset(struct cli_state *cli, uint8 hashed_mach_pwd[16]); +BOOL cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3); +BOOL cli_net_sam_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr); +BOOL change_trust_account_password( char *domain, char *remote_machine_list); + +/*The following definitions come from rpc_client/cli_pipe.c */ + +BOOL rpc_api_pipe_req(struct cli_state *cli, uint8 op_num, + prs_struct *data, prs_struct *rdata); +BOOL rpc_pipe_bind(struct cli_state *cli, char *pipe_name, char *my_name); +void cli_nt_set_ntlmssp_flgs(struct cli_state *cli, uint32 ntlmssp_flgs); +BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name); +void cli_nt_session_close(struct cli_state *cli); + +/*The following definitions come from rpc_client/cli_reg.c */ + +BOOL do_reg_connect(struct cli_state *cli, char *full_keyname, char *key_name, + POLICY_HND *reg_hnd); +BOOL do_reg_open_hklm(struct cli_state *cli, uint16 unknown_0, uint32 level, + POLICY_HND *hnd); +BOOL do_reg_open_hku(struct cli_state *cli, uint16 unknown_0, uint32 level, + POLICY_HND *hnd); +BOOL do_reg_flush_key(struct cli_state *cli, POLICY_HND *hnd); +BOOL do_reg_query_key(struct cli_state *cli, POLICY_HND *hnd, + char *class, uint32 *class_len, + uint32 *num_subkeys, uint32 *max_subkeylen, + uint32 *max_subkeysize, uint32 *num_values, + uint32 *max_valnamelen, uint32 *max_valbufsize, + uint32 *sec_desc, NTTIME *mod_time); +BOOL do_reg_unknown_1a(struct cli_state *cli, POLICY_HND *hnd, uint32 *unk); +BOOL do_reg_query_info(struct cli_state *cli, POLICY_HND *hnd, + char *key_value, uint32* key_type); +BOOL do_reg_set_key_sec(struct cli_state *cli, POLICY_HND *hnd, SEC_DESC_BUF *sec_desc_buf); +BOOL do_reg_get_key_sec(struct cli_state *cli, POLICY_HND *hnd, uint32 *sec_buf_size, SEC_DESC_BUF **ppsec_desc_buf); +BOOL do_reg_delete_val(struct cli_state *cli, POLICY_HND *hnd, char *val_name); +BOOL do_reg_delete_key(struct cli_state *cli, POLICY_HND *hnd, char *key_name); +BOOL do_reg_create_key(struct cli_state *cli, POLICY_HND *hnd, + char *key_name, char *key_class, + SEC_ACCESS *sam_access, + POLICY_HND *key); +BOOL do_reg_enum_key(struct cli_state *cli, POLICY_HND *hnd, + int key_index, char *key_name, + uint32 *unk_1, uint32 *unk_2, + time_t *mod_time); +BOOL do_reg_create_val(struct cli_state *cli, POLICY_HND *hnd, + char *val_name, uint32 type, BUFFER3 *data); +BOOL do_reg_enum_val(struct cli_state *cli, POLICY_HND *hnd, + int val_index, int max_valnamelen, int max_valbufsize, + fstring val_name, + uint32 *val_type, BUFFER2 *value); +BOOL do_reg_open_entry(struct cli_state *cli, POLICY_HND *hnd, + char *key_name, uint32 unk_0, + POLICY_HND *key_hnd); +BOOL do_reg_close(struct cli_state *cli, POLICY_HND *hnd); + +/*The following definitions come from rpc_client/cli_samr.c */ + +BOOL get_samr_query_usergroups(struct cli_state *cli, + POLICY_HND *pol_open_domain, uint32 user_rid, + uint32 *num_groups, DOM_GID *gid); +BOOL get_samr_query_userinfo(struct cli_state *cli, + POLICY_HND *pol_open_domain, + uint32 info_level, + uint32 user_rid, SAM_USER_INFO_21 *usr); +BOOL do_samr_chgpasswd_user(struct cli_state *cli, + char *srv_name, char *user_name, + char nt_newpass[516], uchar nt_oldhash[16], + char lm_newpass[516], uchar lm_oldhash[16]); +BOOL do_samr_unknown_38(struct cli_state *cli, char *srv_name); +BOOL do_samr_query_dom_info(struct cli_state *cli, + POLICY_HND *domain_pol, uint16 switch_value); +BOOL do_samr_enum_dom_users(struct cli_state *cli, + POLICY_HND *pol, uint16 num_entries, uint16 unk_0, + uint16 acb_mask, uint16 unk_1, uint32 size, + struct acct_info **sam, + int *num_sam_users); +BOOL do_samr_connect(struct cli_state *cli, + char *srv_name, uint32 unknown_0, + POLICY_HND *connect_pol); +BOOL do_samr_open_user(struct cli_state *cli, + POLICY_HND *pol, uint32 unk_0, uint32 rid, + POLICY_HND *user_pol); +BOOL do_samr_open_domain(struct cli_state *cli, + POLICY_HND *connect_pol, uint32 rid, DOM_SID *sid, + POLICY_HND *domain_pol); +BOOL do_samr_query_unknown_12(struct cli_state *cli, + POLICY_HND *pol, uint32 rid, uint32 num_gids, uint32 *gids, + uint32 *num_aliases, + fstring als_names [MAX_LOOKUP_SIDS], + uint32 num_als_users[MAX_LOOKUP_SIDS]); +BOOL do_samr_query_usergroups(struct cli_state *cli, + POLICY_HND *pol, uint32 *num_groups, DOM_GID *gid); +BOOL do_samr_query_userinfo(struct cli_state *cli, + POLICY_HND *pol, uint16 switch_value, void* usr); +BOOL do_samr_close(struct cli_state *cli, POLICY_HND *hnd); + +/*The following definitions come from rpc_client/cli_spoolss_notify.c */ + +BOOL spoolss_disconnect_from_client( struct cli_state *cli); +BOOL spoolss_connect_to_client( struct cli_state *cli, char *remote_machine); +BOOL cli_spoolss_reply_open_printer(struct cli_state *cli, char *printer, uint32 localprinter, uint32 type, uint32 *status, POLICY_HND *handle); +BOOL cli_spoolss_reply_rrpcn(struct cli_state *cli, POLICY_HND *handle, + uint32 change_low, uint32 change_high, uint32 *status); +BOOL cli_spoolss_reply_close_printer(struct cli_state *cli, POLICY_HND *handle, uint32 *status); + +/*The following definitions come from rpc_client/cli_srvsvc.c */ + +BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, + char *server_name, char *qual_name, + uint32 switch_value, SRV_CONN_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd); +BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, + char *server_name, char *qual_name, + uint32 switch_value, SRV_SESS_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd); +BOOL do_srv_net_srv_share_enum(struct cli_state *cli, + char *server_name, + uint32 switch_value, SRV_R_NET_SHARE_ENUM *r_o, + uint32 preferred_len, ENUM_HND *hnd); +BOOL do_srv_net_srv_file_enum(struct cli_state *cli, + char *server_name, char *qual_name, + uint32 switch_value, SRV_FILE_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd); +BOOL do_srv_net_srv_get_info(struct cli_state *cli, + char *server_name, uint32 switch_value, SRV_INFO_CTR *ctr); + +/*The following definitions come from rpc_client/cli_use.c */ + +void init_cli_use(void); +void free_cli_use(void); +struct cli_state *cli_net_use_add(const char *srv_name, + const struct ntuser_creds *usr_creds, + BOOL reuse, BOOL *is_new); +BOOL cli_net_use_del(const char *srv_name, + const struct ntuser_creds *usr_creds, + BOOL force_close, BOOL *connection_closed); +void cli_net_use_enum(uint32 *num_cons, struct use_info ***use); +void cli_use_wait_keyboard(void); + +/*The following definitions come from rpc_client/cli_wkssvc.c */ + +BOOL do_wks_query_info(struct cli_state *cli, + char *server_name, uint32 switch_value, + WKS_INFO_100 *wks100); + +/*The following definitions come from rpc_client/ncacn_np_use.c */ + +BOOL ncacn_np_use_del(const char *srv_name, const char *pipe_name, + const vuser_key * key, + BOOL force_close, BOOL *connection_closed); +struct ncacn_np *ncacn_np_initialise(struct ncacn_np *msrpc, + const vuser_key * key); +struct ncacn_np *ncacn_np_use_add(const char *pipe_name, + const vuser_key * key, + const char *srv_name, + const struct ntuser_creds *ntc, + BOOL reuse, BOOL *is_new_connection); +#endif /* _PROTO_H_ */ diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 815939d154..2c3d2eda01 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -37,11 +37,6 @@ #endif /* sprintf */ #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__; -#ifdef snprintf -#undef snprintf -#endif /* snprintf */ -#define snprintf __ERROR__XX__NEVER_USE_SNPRINTF___; - #define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1) #define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1) #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1) diff --git a/source3/include/smb.h b/source3/include/smb.h index c53f0d21e3..7f4825b501 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1222,26 +1222,6 @@ struct bitmap { #define ERRHRD 0x03 /* Error is an hardware error. */ #define ERRCMD 0xFF /* Command was not in the "SMB" format. */ -#ifdef HAVE_STDARG_H -int slprintf(char *str, int n, char *format, ...) -#ifdef __GNUC__ - __attribute__ ((format (__printf__, 3, 4))) -#endif -; -#else -int slprintf(); -#endif - -#ifdef HAVE_STDARG_H -int fdprintf(int fd, char *format, ...) -#ifdef __GNUC__ - __attribute__ ((format (__printf__, 2, 3))) -#endif -; -#else -int fdprintf(); -#endif - #ifdef WITH_DFS void dfs_unlogin(void); extern int dcelogin_atmost_once; diff --git a/source3/lib/debug.c b/source3/lib/debug.c index dc846f1b6f..f7ad324e39 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -450,26 +450,14 @@ void check_log_size( void ) * This is called by dbghdr() and format_debug_text(). * ************************************************************************** ** */ -#ifdef HAVE_STDARG_H int Debug1( char *format_str, ... ) { -#else - int Debug1(va_alist) -va_dcl -{ - char *format_str; -#endif va_list ap; int old_errno = errno; if( stdout_logging ) { -#ifdef HAVE_STDARG_H va_start( ap, format_str ); -#else - va_start( ap ); - format_str = va_arg( ap, char * ); -#endif if(dbf) (void)vfprintf( dbf, format_str, ap ); va_end( ap ); @@ -524,12 +512,7 @@ va_dcl else priority = priority_map[syslog_level]; -#ifdef HAVE_STDARG_H va_start( ap, format_str ); -#else - va_start( ap ); - format_str = va_arg( ap, char * ); -#endif vslprintf( msgbuf, sizeof(msgbuf)-1, format_str, ap ); va_end( ap ); @@ -544,12 +527,7 @@ va_dcl if( !lp_syslog_only() ) #endif { -#ifdef HAVE_STDARG_H va_start( ap, format_str ); -#else - va_start( ap ); - format_str = va_arg( ap, char * ); -#endif if(dbf) (void)vfprintf( dbf, format_str, ap ); va_end( ap ); @@ -740,7 +718,6 @@ BOOL dbghdr( int level, char *file, char *func, int line ) * * ************************************************************************** ** */ -#ifdef HAVE_STDARG_H BOOL dbgtext( char *format_str, ... ) { va_list ap; @@ -755,24 +732,5 @@ BOOL dbghdr( int level, char *file, char *func, int line ) return( True ); } /* dbgtext */ -#else - BOOL dbgtext( va_alist ) - va_dcl - { - char *format_str; - va_list ap; - pstring msgbuf; - - va_start( ap ); - format_str = va_arg( ap, char * ); - vslprintf( msgbuf, sizeof(msgbuf)-1, format_str, ap ); - va_end( ap ); - - format_debug_text( msgbuf ); - - return( True ); - } /* dbgtext */ - -#endif /* ************************************************************************** */ diff --git a/source3/lib/slprintf.c b/source3/lib/slprintf.c index be81b4aa12..2a72fcffc3 100644 --- a/source3/lib/slprintf.c +++ b/source3/lib/slprintf.c @@ -22,74 +22,3 @@ #include "includes.h" extern int DEBUGLEVEL; - - -/* this is like vsnprintf but the 'n' limit does not include - the terminating null. So if you have a 1024 byte buffer then - pass 1023 for n */ -int vslprintf(char *str, int n, char *format, va_list ap) -{ - int ret = vsnprintf(str, n, format, ap); - if (ret > n || ret < 0) { - str[n] = 0; - return -1; - } - str[ret] = 0; - return ret; -} - -#ifdef HAVE_STDARG_H - int slprintf(char *str, int n, char *format, ...) -{ -#else - int slprintf(va_alist) -va_dcl -{ - char *str, *format; - int n; -#endif - va_list ap; - int ret; - -#ifdef HAVE_STDARG_H - va_start(ap, format); -#else - va_start(ap); - str = va_arg(ap,char *); - n = va_arg(ap,int); - format = va_arg(ap,char *); -#endif - - ret = vslprintf(str,n,format,ap); - va_end(ap); - return ret; -} - - /* this is rather line fprintf, except that it works on a file descriptor - and is limited to one pstring of output */ -#ifdef HAVE_STDARG_H - int fdprintf(int fd, char *format, ...) -{ -#else - int fdprintf(va_alist) -va_dcl -{ - int fd; - char *format; -#endif - va_list ap; - pstring str; - -#ifdef HAVE_STDARG_H - va_start(ap, format); -#else - va_start(ap); - fd = va_arg(ap,int); - format = va_arg(ap,char *); -#endif - str[0] = 0; - - vslprintf(str,sizeof(str),format,ap); - va_end(ap); - return write(fd, str, strlen(str)); -} diff --git a/source3/lib/snprintf.c b/source3/lib/snprintf.c index ce7c4a68f5..3edb50c6ad 100644 --- a/source3/lib/snprintf.c +++ b/source3/lib/snprintf.c @@ -735,23 +735,31 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) #endif - -#ifndef HAVE_ASPRINTF - int asprintf(char **ptr, const char *format, ...) +#ifndef HAVE_VASPRINTF + int vasprintf(char **ptr, const char *format, va_list ap) { - va_list ap; int ret; - va_start(ap, format); ret = vsnprintf(NULL, 0, format, ap); - va_end(ap); - if (ret <= 0) return ret; - - va_start(ap, format); + (*ptr) = (char *)malloc(ret+1); if (!*ptr) return -1; ret = vsnprintf(*ptr, ret+1, format, ap); + + return ret; +} +#endif + + +#ifndef HAVE_ASPRINTF + int asprintf(char **ptr, const char *format, ...) +{ + va_list ap; + int ret; + + va_start(ap, format); + ret = vasprintf(ptr, format, ap); va_end(ap); return ret; diff --git a/source3/script/mkproto.awk b/source3/script/mkproto.awk index c66fe07972..13ff399da0 100644 --- a/source3/script/mkproto.awk +++ b/source3/script/mkproto.awk @@ -112,11 +112,11 @@ END { gotstart = 1; } - if( $0 ~ /^TDB_CONTEXT|^TDB_DATA|^smb_ucs2_t|^TALLOC_CTX|^hash_element|^NT_DEVICEMODE|^enum nss_status|^NT_USER_TOKEN|^SAM_ACCOUNT/ ) { + if( $0 ~ /^TDB_CONTEXT|^TDB_DATA|^smb_ucs2_t|^TALLOC_CTX|^hash_element|^NT_DEVICEMODE|^enum.*\(|^NT_USER_TOKEN|^SAM_ACCOUNT/ ) { gotstart = 1; } - if( $0 ~ /^long|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^enum remote_arch_types|^FILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) { + if( $0 ~ /^long|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^FILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) { gotstart = 1; } diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 73815a5c59..8dc3d8308a 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -221,27 +221,15 @@ static BOOL init_package(struct pack_desc* p, int count, int subcount) return(p->errcode == NERR_Success); } -#ifdef HAVE_STDARG_H static int package(struct pack_desc* p, ...) { -#else -static int package(va_alist) -va_dcl -{ - struct pack_desc* p; -#endif va_list args; int needed=0, stringneeded; char* str=NULL; int is_string=0, stringused; int32 temp; -#ifdef HAVE_STDARG_H va_start(args,p); -#else - va_start(args); - p = va_arg(args,struct pack_desc *); -#endif if (!*p->curpos) { if (!p->subcount) |