diff options
author | unknown <peter@mysql.com> | 2002-12-05 01:14:51 +0300 |
---|---|---|
committer | unknown <peter@mysql.com> | 2002-12-05 01:14:51 +0300 |
commit | 5c377fc092dcd14e68bf8d6c07839397b834888a (patch) | |
tree | 9f8ceef21333bf4aa5a3d405ebd33fe7d6143bae /sql | |
parent | 577cb3238b59ab9f885e9c892d137da3b6c8b599 (diff) | |
download | mariadb-git-5c377fc092dcd14e68bf8d6c07839397b834888a.tar.gz |
SCRAM Remove spaces from most changed files.
This alters not only my code so it looks like I'm not only one adding the spaces.
client/mysqladmin.c:
cut spaces
include/mysql_com.h:
cut soaces
sql/item_strfunc.cc:
cut spaces
sql/mini_client.cc:
cut spaces
sql/mysql_priv.h:
cut spaces
sql/mysqld.cc:
cut spaces
sql/password.c:
cut spaces
sql/sql_parse.cc:
cut spaces
sql/sql_yacc.yy:
cut spaces
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_strfunc.cc | 125 | ||||
-rw-r--r-- | sql/mini_client.cc | 16 | ||||
-rw-r--r-- | sql/mysql_priv.h | 10 | ||||
-rw-r--r-- | sql/mysqld.cc | 156 | ||||
-rw-r--r-- | sql/password.c | 238 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 134 |
7 files changed, 341 insertions, 340 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index eb91986e03f..473c4538ab1 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -124,12 +124,12 @@ String *Item_func_sha::val_str(String *str) digest[8], digest[9], digest[10], digest[11], digest[12], digest[13], digest[14], digest[15], digest[16], digest[17], digest[18], digest[19]); - + str->length((uint) SHA1_HASH_SIZE*2); null_value=0; return str; } - } + } null_value=1; return 0; } @@ -153,13 +153,13 @@ String *Item_func_aes_encrypt::val_str(String *str) { null_value=0; aes_length=my_aes_get_size(sptr->length()); // Calculate result length - + if (!str_value.alloc(aes_length)) // Ensure that memory is free { // finally encrypt directly to allocated buffer. if (my_aes_encrypt(sptr->ptr(),sptr->length(), (char*) str_value.ptr(), key->ptr(), key->length()) == aes_length) - { + { // We got the expected result length str_value.length((uint) aes_length); return &str_value; @@ -197,7 +197,7 @@ String *Item_func_aes_decrypt::val_str(String *str) (char*) str_value.ptr(), key->ptr(), key->length()); if (length >= 0) // if we got correct data data - { + { str_value.length((uint) length); DBUG_RETURN(&str_value); } @@ -328,7 +328,7 @@ void Item_func_concat::fix_length_and_dec() } } -/* +/* Function des_encrypt() by tonu@spam.ee & monty Works only if compiled with OpenSSL library support. This returns a binary string where first character is CHAR(128 | key-number). @@ -385,10 +385,10 @@ String *Item_func_des_encrypt::val_str(String *str) des_set_key_unchecked(&keyblock.key3,keyschedule.ks3); } - /* + /* The problem: DES algorithm requires original data to be in 8-bytes - chunks. Missing bytes get filled with '*'s and result of encryption - can be up to 8 bytes longer than original string. When decrypted, + chunks. Missing bytes get filled with '*'s and result of encryption + can be up to 8 bytes longer than original string. When decrypted, we do not know the size of original string :( We add one byte with value 0x1..0x8 as the last byte of the padded string marking change of string length. @@ -459,7 +459,7 @@ String *Item_func_des_decrypt::val_str(String *str) // Here we set all 64-bit keys (56 effective) one by one des_set_key_unchecked(&keyblock.key1,keyschedule.ks1); des_set_key_unchecked(&keyblock.key2,keyschedule.ks2); - des_set_key_unchecked(&keyblock.key3,keyschedule.ks3); + des_set_key_unchecked(&keyblock.key3,keyschedule.ks3); } if (tmp_value.alloc(length-1)) goto error; @@ -485,7 +485,7 @@ error: } -/* +/* concat with separator. First arg is the separator concat_ws takes at least two arguments. */ @@ -683,7 +683,7 @@ String *Item_func_replace::val_str(String *str) #ifdef USE_MB const char *ptr,*end,*strend,*search,*search_end; register uint32 l; - bool binary_str; + bool binary_str; #endif null_value=0; @@ -1279,7 +1279,8 @@ String *Item_func_password::val_str(String *str) return 0; if (res->length() == 0) return &empty_string; - make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords,¤t_thd->rand); + make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords, + ¤t_thd->rand); str->set(tmp_value,get_password_length(opt_old_passwords),res->charset()); return str; } @@ -1392,7 +1393,7 @@ String *Item_func_user::val_str(String *str) CHARSET_INFO *cs=thd->thd_charset; const char *host=thd->host ? thd->host : thd->ip ? thd->ip : ""; uint32 res_length=(strlen(thd->user)+strlen(host)+10) * cs->mbmaxlen; - + if (str->alloc(res_length)) { null_value=1; @@ -1669,7 +1670,7 @@ String *Item_func_char::val_str(String *str) } else if (num&0xFF0000L) { b2: str->append((char)(num>>16)); goto b1; - } else if (num&0xFF00L) { + } else if (num&0xFF00L) { b1: str->append((char)(num>>8)); } } @@ -1938,25 +1939,25 @@ String *Item_func_conv_charset::val_str(String *str) uint32 dmaxlen; String *arg= args[0]->val_str(str); CHARSET_INFO *from,*to; - + if (!arg) { null_value=1; return 0; } null_value=0; - + from=arg->charset(); to=conv_charset; s=(const uchar*)arg->ptr(); se=s+arg->length(); - + dmaxlen=arg->length()*to->mbmaxlen+1; str->alloc(dmaxlen); d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; - + while( s < se && d < de){ cnvres=from->mb_wc(from,&wc,s,se); @@ -1986,7 +1987,7 @@ outp: else break; }; - + str->length((uint32) (d-d0)); str->set_charset(to); return str; @@ -2012,9 +2013,9 @@ String *Item_func_conv_charset3::val_str(String *str) String *from_cs= args[2]->val_str(str); CHARSET_INFO *from_charset; CHARSET_INFO *to_charset; - - if (!arg || args[0]->null_value || - !to_cs || args[1]->null_value || + + if (!arg || args[0]->null_value || + !to_cs || args[1]->null_value || !from_cs || args[2]->null_value || !(from_charset=get_charset_by_name(from_cs->ptr(), MYF(MY_WME))) || !(to_charset=get_charset_by_name(to_cs->ptr(), MYF(MY_WME)))) @@ -2025,12 +2026,12 @@ String *Item_func_conv_charset3::val_str(String *str) s=(const uchar*)arg->ptr(); se=s+arg->length(); - + dmaxlen=arg->length()*to_charset->mbmaxlen+1; str->alloc(dmaxlen); d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; - + while( s < se && d < de){ cnvres=from_charset->mb_wc(from_charset,&wc,s,se); @@ -2060,7 +2061,7 @@ outp: else break; }; - + str->length((uint32) (d-d0)); str->set_charset(to_charset); return str; @@ -2072,7 +2073,7 @@ bool Item_func_conv_charset::fix_fields(THD *thd,struct st_table_list *tables, I char buff[STACK_BUFF_ALLOC]; // Max argument in function used_tables_cache=0; const_item_cache=1; - + if (thd && check_stack_overrun(thd,buff)) return 0; // Fatal error if flag is set! if (args[0]->check_cols(1) || args[0]->fix_fields(thd, tables, args)) @@ -2105,7 +2106,7 @@ bool Item_func_set_collation::fix_fields(THD *thd,struct st_table_list *tables, char buff[STACK_BUFF_ALLOC]; // Max argument in function used_tables_cache=0; const_item_cache=1; - + if (thd && check_stack_overrun(thd,buff)) return 0; // Fatal error if flag is set! if (args[0]->check_cols(1) || args[0]->fix_fields(thd, tables, args)) @@ -2236,11 +2237,11 @@ err: String* Item_func_export_set::val_str(String* str) { ulonglong the_set = (ulonglong) args[0]->val_int(); - String yes_buf, *yes; + String yes_buf, *yes; yes = args[1]->val_str(&yes_buf); - String no_buf, *no; + String no_buf, *no; no = args[2]->val_str(&no_buf); - String *sep = NULL, sep_buf ; + String *sep = NULL, sep_buf ; uint num_set_values = 64; ulonglong mask = 0x1; @@ -2314,7 +2315,7 @@ String* Item_func_inet_ntoa::val_str(String* str) int4store(buf,n); /* Now we can assume little endian. */ - + num[3]='.'; for (p=buf+4 ; p-- > buf ; ) { @@ -2343,7 +2344,7 @@ String* Item_func_inet_ntoa::val_str(String* str) DESCRIPTION Adds a \ before all characters that needs to be escaped in a SQL string. We also escape '^Z' (END-OF-FILE in windows) to avoid probelms when - running commands from a file in windows. + running commands from a file in windows. This function is very useful when you want to generate SQL statements @@ -2359,7 +2360,7 @@ String *Item_func_quote::val_str(String *str) /* Bit mask that has 1 for set for the position of the following characters: 0, \, ' and ^Z - */ + */ static uchar escmask[32]= { @@ -2457,7 +2458,7 @@ String *Item_func_as_text::val_str(String *str) Geometry geom; if ((null_value=(args[0]->null_value || - geom.create_from_wkb(wkt->ptr(),wkt->length())))) + geom.create_from_wkb(wkt->ptr(),wkt->length())))) return 0; str->length(0); @@ -2494,7 +2495,7 @@ String *Item_func_envelope::val_str(String *str) Geometry geom; null_value = args[0]->null_value || - geom.create_from_wkb(wkb->ptr(),wkb->length()) || + geom.create_from_wkb(wkb->ptr(),wkb->length()) || geom.envelope(str); return null_value ? 0 : str; @@ -2507,7 +2508,7 @@ String *Item_func_centroid::val_str(String *str) Geometry geom; null_value = args[0]->null_value || - geom.create_from_wkb(wkb->ptr(),wkb->length()) || + geom.create_from_wkb(wkb->ptr(),wkb->length()) || !GEOM_METHOD_PRESENT(geom,centroid) || geom.centroid(str); @@ -2551,7 +2552,7 @@ String *Item_func_spatial_decomp::val_str(String *str) } null_value=0; -ret: +ret: return null_value ? 0 : str; } @@ -2562,7 +2563,7 @@ String *Item_func_spatial_decomp_n::val_str(String *str) long n = (long) args[1]->val_int(); Geometry geom; - if ((null_value = (args[0]->null_value || + if ((null_value = (args[0]->null_value || args[1]->null_value || geom.create_from_wkb(wkb->ptr(),wkb->length()) ))) return 0; @@ -2572,19 +2573,19 @@ String *Item_func_spatial_decomp_n::val_str(String *str) switch(decomp_func_n) { case SP_POINTN: - if (!GEOM_METHOD_PRESENT(geom,point_n) || + if (!GEOM_METHOD_PRESENT(geom,point_n) || geom.point_n(n,str)) goto ret; break; case SP_GEOMETRYN: - if (!GEOM_METHOD_PRESENT(geom,geometry_n) || + if (!GEOM_METHOD_PRESENT(geom,geometry_n) || geom.geometry_n(n,str)) goto ret; break; case SP_INTERIORRINGN: - if (!GEOM_METHOD_PRESENT(geom,interior_ring_n) || + if (!GEOM_METHOD_PRESENT(geom,interior_ring_n) || geom.interior_ring_n(n,str)) goto ret; break; @@ -2612,7 +2613,7 @@ Functions to concatinate various spatial objects String *Item_func_point::val_str(String *str) { - if ( (null_value = (args[0]->null_value || + if ( (null_value = (args[0]->null_value || args[1]->null_value || str->realloc(1+4+8+8)))) return 0; @@ -2627,12 +2628,12 @@ String *Item_func_point::val_str(String *str) /* - Concatinates various items into various collections + Concatinates various items into various collections with checkings for valid wkb type of items. For example, MultiPoint can be a collection of Points only. coll_type contains wkb type of target collection. item_type contains a valid wkb type of items. - In the case when coll_type is wkbGeometryCollection, + In the case when coll_type is wkbGeometryCollection, we do not check wkb type of items, any is valid. */ @@ -2659,14 +2660,14 @@ String *Item_func_spatial_collection::val_str(String *str) if ( coll_type == Geometry::wkbGeometryCollection ) { - /* - In the case of GeometryCollection we don't need + /* + In the case of GeometryCollection we don't need any checkings for item types, so just copy them into target collection */ if ((null_value=(str->reserve(res->length(),512)))) goto ret; - + str->q_append(res->ptr(),res->length()); } else @@ -2675,12 +2676,12 @@ String *Item_func_spatial_collection::val_str(String *str) uint32 len=res->length(); const char *data=res->ptr()+1; - /* - In the case of named collection we must to + /* + In the case of named collection we must to check that items are of specific type, let's do this checking now */ - + if (len < 5) goto ret; wkb_type= (Geometry::wkbType) uint4korr(data); @@ -2688,14 +2689,14 @@ String *Item_func_spatial_collection::val_str(String *str) len-=5; if (wkb_type != item_type) goto ret; - + switch (coll_type) { case Geometry::wkbMultiPoint: case Geometry::wkbMultiLineString: case Geometry::wkbMultiPolygon: - if (len < WKB_HEADER_SIZE) + if (len < WKB_HEADER_SIZE) goto ret; - + data+=WKB_HEADER_SIZE; len-=WKB_HEADER_SIZE; if (str->reserve(len,512)) @@ -2710,43 +2711,43 @@ String *Item_func_spatial_collection::val_str(String *str) break; case Geometry::wkbPolygon: - { + { uint32 n_points; double x1, y1, x2, y2; - if (len < WKB_HEADER_SIZE + 4 + 8 + 8) + if (len < WKB_HEADER_SIZE + 4 + 8 + 8) goto ret; data+=WKB_HEADER_SIZE; len-=WKB_HEADER_SIZE; uint32 llen=len; const char *ldata=data; - + n_points=uint4korr(data); data+=4; float8get(x1,data); data+=8; float8get(y1,data); data+=8; - + len-= 4 + 8 + 8; - + if (len < n_points * POINT_DATA_SIZE) goto ret; data+=(n_points-2) * POINT_DATA_SIZE; float8get(x2,data); float8get(y2,data+8); - + if ((x1 != x2) || (y1 != y2)) goto ret; - + if (str->reserve(llen,512)) goto ret; str->q_append(ldata, llen); } break; - + default: goto ret; } diff --git a/sql/mini_client.cc b/sql/mini_client.cc index 27d6255d82a..7f841255454 100644 --- a/sql/mini_client.cc +++ b/sql/mini_client.cc @@ -328,7 +328,7 @@ static int mc_sock_connect(my_socket s, const struct sockaddr *name, ** or packet is an error message *****************************************************************************/ -ulong +ulong mc_net_safe_read(MYSQL *mysql) { NET *net= &mysql->net; @@ -433,7 +433,7 @@ my_bool mc_mysql_reconnect(MYSQL *mysql) -int +int mc_simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, uint length, my_bool skipp_check) { @@ -483,7 +483,7 @@ mc_simple_command(MYSQL *mysql,enum enum_server_command command, } -MYSQL * +MYSQL * mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket,uint client_flag, @@ -662,7 +662,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, vio_poll_read(net->vio, mysql->options.connect_timeout)) { net->last_errno= CR_SERVER_LOST; - strmov(net->last_error,ER(net->last_errno)); + strmov(net->last_error,ER(net->last_errno)); goto error; } if ((pkt_length=mc_net_safe_read(mysql)) == packet_error) @@ -777,7 +777,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, if (my_net_write(net,buff,(uint) (2)) || net_flush(net)) { net->last_errno= CR_SERVER_LOST; - strmov(net->last_error,ER(net->last_errno)); + strmov(net->last_error,ER(net->last_errno)); goto error; } /* Do the SSL layering. */ @@ -801,7 +801,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, } DBUG_PRINT("info",("user: %s",buff+5)); - + /* We always start with old type handshake the only difference is message sent If server handles secure connection type we'll not send the real scramble @@ -918,7 +918,7 @@ error: ** NB! Errors are not reported until you do mysql_real_connect. ************************************************************************** */ -int +int mysql_ssl_clear(MYSQL *mysql) { my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR)); @@ -943,7 +943,7 @@ mysql_ssl_clear(MYSQL *mysql) ** If handle is alloced by mysql connect free it. *************************************************************************/ -void +void mc_mysql_close(MYSQL *mysql) { DBUG_ENTER("mysql_close"); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 0b4759fd388..390f7613603 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -472,9 +472,9 @@ Field *find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length, bool check_grant,bool allow_rowid); #ifdef HAVE_OPENSSL -struct st_des_keyblock -{ - des_cblock key1, key2, key3; +struct st_des_keyblock +{ + des_cblock key1, key2, key3; }; struct st_des_keyschedule { @@ -555,9 +555,9 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables, enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND, IGNORE_ERRORS}; extern const Item **not_found_item; -Item ** find_item_in_list(Item *item, List<Item> &items, +Item ** find_item_in_list(Item *item, List<Item> &items, find_item_error_report_type report_error); -bool insert_fields(THD *thd,TABLE_LIST *tables, +bool insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name, const char *table_name, List_iterator<Item> *it); bool setup_tables(TABLE_LIST *tables); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c7e854611b9..a91700956e9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -56,7 +56,7 @@ char pstack_file_name[80]; #if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ) #define HAVE_CLOSE_SERVER_SOCK 1 -#endif +#endif extern "C" { // Because of SCO 3.2V4.2 #include <errno.h> @@ -256,7 +256,7 @@ my_bool opt_skip_slave_start = 0; // If set, slave is not autostarted If set, some standard measures to enforce slave data integrity will not be performed */ -my_bool opt_reckless_slave = 0; +my_bool opt_reckless_slave = 0; ulong back_log, connect_timeout, concurrency; char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30]; @@ -337,7 +337,7 @@ ulong query_cache_size=0; ulong query_cache_limit=0; Query_cache query_cache; #endif -arg_cmp_func Arg_comparator::comparator_matrix[4][2] = +arg_cmp_func Arg_comparator::comparator_matrix[4][2] = {{&Arg_comparator::compare_string, &Arg_comparator::compare_e_string}, {&Arg_comparator::compare_real, &Arg_comparator::compare_e_real}, {&Arg_comparator::compare_int, &Arg_comparator::compare_e_int}, @@ -355,7 +355,7 @@ my_string master_user = (char*) "test", master_password = 0, master_host=0, relay_log_info_file = (char*) "relay-log.info", master_ssl_key=0, master_ssl_cert=0, master_ssl_capath=0, master_ssl_cipher=0; my_string report_user = 0, report_password = 0, report_host=0; - + const char *localhost=LOCAL_HOST; const char *delayed_user="DELAYED"; uint master_port = MYSQL_PORT, master_connect_retry = 60; @@ -384,7 +384,7 @@ ulong max_connections,max_insert_delayed_threads,max_used_connections, max_connect_errors, max_user_connections = 0; ulong thread_id=1L,current_pid; ulong slow_launch_threads = 0; - + char mysql_real_data_home[FN_REFLEN], language[LIBLEN],reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN], *charsets_list, @@ -557,7 +557,7 @@ static void close_connections(void) { HANDLE temp; DBUG_PRINT( "quit", ("Closing named pipes") ); - + /* Create connection to the handle named pipe handler to break the loop */ if ((temp = CreateFile(szPipeName, GENERIC_READ | GENERIC_WRITE, @@ -676,7 +676,7 @@ static void close_server_sock() The following code is disabled as it causes MySQL to hang on AIX 4.3 during shutdown */ - DBUG_PRINT("info",("calling closesocket on TCP/IP socket")); + DBUG_PRINT("info",("calling closesocket on TCP/IP socket")); VOID(closesocket(tmp_sock)); #endif } @@ -708,7 +708,7 @@ void kill_mysql(void) #ifdef SIGNALS_DONT_BREAK_READ abort_loop=1; // Break connection loops close_server_sock(); // Force accept to wake up -#endif +#endif #if defined(__WIN__) #if !defined(EMBEDDED_LIBRARY) @@ -746,7 +746,7 @@ void kill_mysql(void) (void*) 0)) sql_print_error("Error: Can't create thread to kill server"); } -#endif +#endif DBUG_VOID_RETURN; } @@ -1379,7 +1379,7 @@ extern "C" sig_handler handle_segfault(int sig) fprintf(stderr, "Fatal signal %d while backtracing\n", sig); exit(1); } - + segfaulted = 1; fprintf(stderr,"\ mysqld got signal %d;\n\ @@ -1403,7 +1403,7 @@ bytes of memory\n", (keybuff_size + (global_system_variables.read_buff_size + thd->variables.sortbuff_size) * max_connections)/ 1024); fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n"); - + #if defined(HAVE_LINUXTHREADS) if (sizeof(char*) == 4 && thread_count > UNSAFE_DEFAULT_LINUX_THREADS) { @@ -2028,7 +2028,7 @@ int main(int argc, char **argv) NullS, LOG_NEW); using_update_log=1; } - + if (opt_slow_log) open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log", NullS, LOG_NORMAL); @@ -2109,7 +2109,7 @@ int main(int argc, char **argv) #endif /* init_slave() must be called after the thread keys are created */ init_slave(); - + if (opt_bin_log && !server_id) { server_id= !master_host ? 1 : 2; @@ -2310,7 +2310,7 @@ int mysql_service(void *p) SYNOPSIS default_service_handling() - argv Pointer to argument list + argv Pointer to argument list servicename Internal name of service displayname Display name of service (in taskbar ?) file_path Path to this program @@ -2353,7 +2353,7 @@ int main(int argc, char **argv) fn_format(file_path,argv[0],file_path,"",1+4+16); /* Force full path */ if (argc == 2) - { + { if (!default_service_handling(argv,MYSQL_SERVICENAME, MYSQL_SERVICENAME, file_path)) return 0; @@ -2441,7 +2441,7 @@ static int bootstrap(FILE *file) if (pthread_create(&thd->real_id,&connection_attrib,handle_bootstrap, (void*) thd)) { - sql_print_error("Warning: Can't create thread to handle bootstrap"); + sql_print_error("Warning: Can't create thread to handle bootstrap"); DBUG_RETURN(-1); } /* Wait for thread to die */ @@ -2498,7 +2498,7 @@ static void create_new_thread(THD *thd) thd->scramble[8]=0; // Back it up as old clients may need it memcpy(thd->old_scramble,thd->scramble,9); - + thd->real_id=pthread_self(); // Keep purify happy @@ -2860,7 +2860,7 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg) } #endif /* __NT__ */ -/* +/* Thread of shared memory's service SYNOPSIS @@ -2871,10 +2871,10 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg) #ifdef HAVE_SMEM pthread_handler_decl(handle_connections_shared_memory,arg) { -/* - event_connect_request is event object for start connection actions +/* + event_connect_request is event object for start connection actions event_connect_answer is event object for confirm, that server put data - handle_connect_file_map is file-mapping object, use for create shared memory + handle_connect_file_map is file-mapping object, use for create shared memory handle_connect_map is pointer on shared memory handle_map is pointer on shared memory for client event_server_wrote, @@ -2894,7 +2894,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg) char tmp[63]; char *suffix_pos; char connect_number_char[22], *p; - + my_thread_init(); DBUG_ENTER("handle_connections_shared_memorys"); DBUG_PRINT("general",("Waiting for allocated shared memory.")); @@ -2908,27 +2908,27 @@ pthread_handler_decl(handle_connections_shared_memory,arg) unique_part is unique value for each object (events and file-mapping) */ suffix_pos = strxmov(tmp,shared_memory_base_name,"_",NullS); - strmov(suffix_pos, "CONNECT_REQUEST"); - if ((event_connect_request = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) + strmov(suffix_pos, "CONNECT_REQUEST"); + if ((event_connect_request = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) { sql_perror("Can't create shared memory service ! The request event don't create."); goto error; } - strmov(suffix_pos, "CONNECT_ANSWER"); - if ((event_connect_answer = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) + strmov(suffix_pos, "CONNECT_ANSWER"); + if ((event_connect_answer = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) { sql_perror("Can't create shared memory service ! The answer event don't create."); goto error; } - strmov(suffix_pos, "CONNECT_DATA"); + strmov(suffix_pos, "CONNECT_DATA"); if ((handle_connect_file_map = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE, - 0,sizeof(connect_number),tmp)) == 0) + 0,sizeof(connect_number),tmp)) == 0) { sql_perror("Can't create shared memory service ! File mapping don't create."); goto error; } if ((handle_connect_map = (char *)MapViewOfFile(handle_connect_file_map,FILE_MAP_WRITE,0,0, - sizeof(DWORD))) == 0) + sizeof(DWORD))) == 0) { sql_perror("Can't create shared memory service ! Map of memory don't create."); goto error; @@ -2940,7 +2940,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg) /* Wait a request from client */ - WaitForSingleObject(event_connect_request,INFINITE); + WaitForSingleObject(event_connect_request,INFINITE); error_allow = FALSE; HANDLE handle_client_file_map = NULL; @@ -2962,13 +2962,13 @@ pthread_handler_decl(handle_connections_shared_memory,arg) suffix_pos = strxmov(tmp,shared_memory_base_name,"_",connect_number_char,"_",NullS); strmov(suffix_pos, "DATA"); if ((handle_client_file_map = CreateFileMapping(INVALID_HANDLE_VALUE,NULL, - PAGE_READWRITE,0,smem_buffer_length,tmp)) == 0) + PAGE_READWRITE,0,smem_buffer_length,tmp)) == 0) { sql_perror("Can't create connection with client in shared memory service ! File mapping don't create."); error_allow = TRUE; goto errorconn; } - if ((handle_client_map = (char*)MapViewOfFile(handle_client_file_map,FILE_MAP_WRITE,0,0,smem_buffer_length)) == 0) + if ((handle_client_map = (char*)MapViewOfFile(handle_client_file_map,FILE_MAP_WRITE,0,0,smem_buffer_length)) == 0) { sql_perror("Can't create connection with client in shared memory service ! Map of memory don't create."); error_allow = TRUE; @@ -2976,7 +2976,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg) } strmov(suffix_pos, "CLIENT_WROTE"); - if ((event_client_wrote = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) + if ((event_client_wrote = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) { sql_perror("Can't create connection with client in shared memory service ! CW event don't create."); error_allow = TRUE; @@ -2984,7 +2984,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg) } strmov(suffix_pos, "CLIENT_READ"); - if ((event_client_read = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) + if ((event_client_read = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) { sql_perror("Can't create connection with client in shared memory service ! CR event don't create."); error_allow = TRUE; @@ -2992,7 +2992,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg) } strmov(suffix_pos, "SERVER_READ"); - if ((event_server_read = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) + if ((event_server_read = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) { sql_perror("Can't create connection with client in shared memory service ! SR event don't create."); error_allow = TRUE; @@ -3000,7 +3000,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg) } strmov(suffix_pos, "SERVER_WROTE"); - if ((event_server_wrote = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) + if ((event_server_wrote = CreateEvent(NULL,FALSE,FALSE,tmp)) == 0) { sql_perror("Can't create connection with client in shared memory service ! SW event don't create."); error_allow = TRUE; @@ -3018,11 +3018,11 @@ pthread_handler_decl(handle_connections_shared_memory,arg) Send number of connection to client */ int4store(handle_connect_map, connect_number); - + /* Send number of connection to client */ - if (!SetEvent(event_connect_answer)) + if (!SetEvent(event_connect_answer)) { sql_perror("Can't create connection with client in shared memory service ! Can't send answer event."); error_allow = TRUE; @@ -3079,25 +3079,25 @@ error: ******************************************************************************/ enum options { - OPT_ISAM_LOG=256, OPT_SKIP_NEW, - OPT_SKIP_GRANT, OPT_SKIP_LOCK, + OPT_ISAM_LOG=256, OPT_SKIP_NEW, + OPT_SKIP_GRANT, OPT_SKIP_LOCK, OPT_ENABLE_LOCK, OPT_USE_LOCKING, - OPT_SOCKET, OPT_UPDATE_LOG, - OPT_BIN_LOG, OPT_SKIP_RESOLVE, + OPT_SOCKET, OPT_UPDATE_LOG, + OPT_BIN_LOG, OPT_SKIP_RESOLVE, OPT_SKIP_NETWORKING, OPT_BIN_LOG_INDEX, OPT_BIND_ADDRESS, OPT_PID_FILE, - OPT_SKIP_PRIOR, OPT_BIG_TABLES, + OPT_SKIP_PRIOR, OPT_BIG_TABLES, OPT_STANDALONE, OPT_ONE_THREAD, OPT_CONSOLE, OPT_LOW_PRIORITY_UPDATES, - OPT_SKIP_HOST_CACHE, OPT_LONG_FORMAT, - OPT_FLUSH, OPT_SAFE, + OPT_SKIP_HOST_CACHE, OPT_LONG_FORMAT, + OPT_FLUSH, OPT_SAFE, OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB, - OPT_TABLE_TYPE, OPT_INIT_FILE, - OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG, + OPT_TABLE_TYPE, OPT_INIT_FILE, + OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG, OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR, - OPT_BDB_HOME, OPT_BDB_LOG, + OPT_BDB_HOME, OPT_BDB_LOG, OPT_BDB_TMP, OPT_BDB_NOSYNC, - OPT_BDB_LOCK, OPT_BDB_SKIP, + OPT_BDB_LOCK, OPT_BDB_SKIP, OPT_BDB_NO_RECOVER, OPT_BDB_SHARED, OPT_MASTER_HOST, OPT_MASTER_USER, OPT_MASTER_PASSWORD, OPT_MASTER_PORT, @@ -3106,26 +3106,26 @@ enum options { OPT_MASTER_SSL, OPT_MASTER_SSL_KEY, OPT_MASTER_SSL_CERT, OPT_MASTER_SSL_CAPATH, OPT_MASTER_SSL_CIPHER, - OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB, + OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB, OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES, OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB, OPT_WANT_CORE, OPT_CONCURRENT_INSERT, OPT_MEMLOCK, OPT_MYISAM_RECOVER, - OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID, + OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID, OPT_SKIP_SLAVE_START, OPT_SKIP_INNOBASE, - OPT_SAFEMALLOC_MEM_LIMIT, OPT_REPLICATE_DO_TABLE, - OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE, - OPT_REPLICATE_WILD_IGNORE_TABLE, - OPT_DISCONNECT_SLAVE_EVENT_COUNT, + OPT_SAFEMALLOC_MEM_LIMIT, OPT_REPLICATE_DO_TABLE, + OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE, + OPT_REPLICATE_WILD_IGNORE_TABLE, + OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_ABORT_SLAVE_EVENT_COUNT, OPT_INNODB_DATA_HOME_DIR, OPT_INNODB_DATA_FILE_PATH, - OPT_INNODB_LOG_GROUP_HOME_DIR, - OPT_INNODB_LOG_ARCH_DIR, - OPT_INNODB_LOG_ARCHIVE, - OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT, - OPT_INNODB_FLUSH_METHOD, - OPT_INNODB_FAST_SHUTDOWN, + OPT_INNODB_LOG_GROUP_HOME_DIR, + OPT_INNODB_LOG_ARCH_DIR, + OPT_INNODB_LOG_ARCHIVE, + OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT, + OPT_INNODB_FLUSH_METHOD, + OPT_INNODB_FAST_SHUTDOWN, OPT_SAFE_SHOW_DB, OPT_INNODB_SKIP, OPT_SKIP_SAFEMALLOC, OPT_TEMP_POOL, OPT_TX_ISOLATION, @@ -3162,7 +3162,7 @@ enum options { OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE, OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT, OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT, - OPT_OPEN_FILES_LIMIT, + OPT_OPEN_FILES_LIMIT, OPT_QUERY_CACHE_LIMIT, OPT_QUERY_CACHE_SIZE, OPT_QUERY_CACHE_TYPE, OPT_RECORD_BUFFER, OPT_RECORD_RND_BUFFER, OPT_RELAY_LOG_SPACE_LIMIT, @@ -3265,7 +3265,7 @@ struct my_option my_long_options[] = #endif #endif #ifdef HAVE_OPENSSL - {"des-key-file", OPT_DES_KEY_FILE, + {"des-key-file", OPT_DES_KEY_FILE, "Load keys for des_encrypt() and des_encrypt from given file", (gptr*) &des_key_file, (gptr*) &des_key_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -3297,7 +3297,7 @@ struct my_option my_long_options[] = {"shared-memory", OPT_ENABLE_SHARED_MEMORY, "Enable the shared memory.",(gptr*) &opt_enable_shared_memory, (gptr*) &opt_enable_shared_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif +#endif {"exit-info", 'T', "Used for debugging; Use at your own risk!", 0, 0, 0, GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"flush", OPT_FLUSH, "Flush tables to disk between SQL commands", 0, 0, 0, @@ -3315,7 +3315,7 @@ struct my_option my_long_options[] = (gptr*) &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR, - "Path to innodb log files.", (gptr*) &innobase_log_group_home_dir, + "Path to innodb log files.", (gptr*) &innobase_log_group_home_dir, (gptr*) &innobase_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_log_arch_dir", OPT_INNODB_LOG_ARCH_DIR, @@ -3375,7 +3375,7 @@ struct my_option my_long_options[] = {"log-long-format", OPT_LONG_FORMAT, "Log some extra information to update log", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"log-slave-updates", OPT_LOG_SLAVE_UPDATES, + {"log-slave-updates", OPT_LOG_SLAVE_UPDATES, "Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.", (gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -3384,7 +3384,7 @@ struct my_option my_long_options[] = (gptr*) &global_system_variables.low_priority_updates, (gptr*) &max_system_variables.low_priority_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"master-host", OPT_MASTER_HOST, + {"master-host", OPT_MASTER_HOST, "Master hostname or IP address for replication. If not set, the slave thread will not be started. Note that the setting of master-host will be ignored if there exists a valid master.info file.", (gptr*) &master_host, (gptr*) &master_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -3531,7 +3531,7 @@ struct my_option my_long_options[] = {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for old clients)", - (gptr*) &opt_old_passwords, (gptr*) &opt_old_passwords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + (gptr*) &opt_old_passwords, (gptr*) &opt_old_passwords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef TO_BE_DELETED {"safe-show-database", OPT_SAFE_SHOW_DB, "Deprecated option; One should use GRANT SHOW DATABASES instead...", @@ -3550,7 +3550,7 @@ struct my_option my_long_options[] = 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_SMEM {"shared_memory_base_name",OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name, + "Base name of shared memory", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif {"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO, @@ -3681,7 +3681,7 @@ struct my_option my_long_options[] = "The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.", (gptr*) &binlog_cache_size, (gptr*) &binlog_cache_size, 0, GET_ULONG, REQUIRED_ARG, 32*1024L, IO_SIZE, ~0L, 0, IO_SIZE, 0}, - {"connect_timeout", OPT_CONNECT_TIMEOUT, + {"connect_timeout", OPT_CONNECT_TIMEOUT, "The number of seconds the mysqld server is waiting for a connect packet before responding with Bad handshake", (gptr*) &connect_timeout, (gptr*) &connect_timeout, 0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 }, @@ -3715,7 +3715,7 @@ struct my_option my_long_options[] = HA_FT_MAXLEN, 0, 1, 0}, #ifdef HAVE_INNOBASE_DB {"innodb_mirrored_log_groups", OPT_INNODB_MIRRORED_LOG_GROUPS, - "Number of identical copies of log groups we keep for the database. Currently this should be set to 1.", + "Number of identical copies of log groups we keep for the database. Currently this should be set to 1.", (gptr*) &innobase_mirrored_log_groups, (gptr*) &innobase_mirrored_log_groups, 0, GET_LONG, REQUIRED_ARG, 1, 1, 10, 0, 1, 0}, @@ -3873,7 +3873,7 @@ struct my_option my_long_options[] = (gptr*) &max_system_variables.myisam_sort_buff_size, 0, GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0}, {"net_buffer_length", OPT_NET_BUFFER_LENGTH, - "Buffer length for TCP/IP and socket communication.", + "Buffer length for TCP/IP and socket communication.", (gptr*) &global_system_variables.net_buffer_length, (gptr*) &max_system_variables.net_buffer_length, 0, GET_ULONG, REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0}, @@ -4103,7 +4103,7 @@ struct show_var_st status_vars[]= { {"Qcache_hits", (char*) &query_cache.hits, SHOW_LONG}, {"Qcache_lowmem_prunes", (char*) &query_cache.lowmem_prunes, SHOW_LONG}, {"Qcache_not_cached", (char*) &query_cache.refused, SHOW_LONG}, - {"Qcache_free_memory", (char*) &query_cache.free_memory, + {"Qcache_free_memory", (char*) &query_cache.free_memory, SHOW_LONG_CONST}, {"Qcache_free_blocks", (char*) &query_cache.free_memory_blocks, SHOW_LONG_CONST}, @@ -4288,9 +4288,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), init_slave_skip_errors(argument); break; case OPT_SAFEMALLOC_MEM_LIMIT: -#if !defined(DBUG_OFF) && defined(SAFEMALLOC) +#if !defined(DBUG_OFF) && defined(SAFEMALLOC) safemalloc_mem_limit = atoi(argument); -#endif +#endif break; #ifdef EMBEDDED_LIBRARY case OPT_MAX_ALLOWED_PACKET: @@ -4352,7 +4352,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case (int)OPT_REPLICATE_REWRITE_DB: { char* key = argument,*p, *val; - + if (!(p= strstr(argument, "->"))) { fprintf(stderr, @@ -4744,7 +4744,7 @@ static void get_options(int argc,char **argv) myisam_max_temp_length= (my_off_t) min(global_system_variables.myisam_max_sort_file_size, (ulonglong) MAX_FILE_SIZE); - myisam_max_extra_temp_length= + myisam_max_extra_temp_length= (my_off_t) min(global_system_variables.myisam_max_extra_sort_file_size, (ulonglong) MAX_FILE_SIZE); @@ -4925,7 +4925,7 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib) j=pos; while (j != end) { - if (my_toupper(system_charset_info,*i++) != + if (my_toupper(system_charset_info,*i++) != my_toupper(system_charset_info,*j++)) goto skipp; } diff --git a/sql/password.c b/sql/password.c index 7a3831d67b7..6f1557bbd34 100644 --- a/sql/password.c +++ b/sql/password.c @@ -32,26 +32,26 @@ Example: update user set password=PASSWORD("hello") where user="test" This saves a hashed number as a string in the password field. - - + + New in MySQL 4.1 authentication works even more secure way. - At the first step client sends user name to the sever, and password if + At the first step client sends user name to the sever, and password if it is empty. So in case of empty password authentication is as fast as before. At the second stap servers sends scramble to client, which is encoded with - password stage2 hash stored in the password database as well as salt, needed - for client to build stage2 password to decrypt scramble. + password stage2 hash stored in the password database as well as salt, needed + for client to build stage2 password to decrypt scramble. Client decrypts the scramble and encrypts it once again with stage1 password. This information is sent to server. - Server decrypts the scramble to get stage1 password and hashes it to get + Server decrypts the scramble to get stage1 password and hashes it to get stage2 hash. This hash is when compared to hash stored in the database. - - This authentication needs 2 packet round trips instead of one but it is much - stronger. Now if one will steal mysql database content he will not be able + + This authentication needs 2 packet round trips instead of one but it is much + stronger. Now if one will steal mysql database content he will not be able to break into MySQL. New Password handling functions by Peter Zaitsev - - + + *****************************************************************************/ #include <my_global.h> @@ -70,17 +70,17 @@ /* New (MySQL 3.21+) random generation structure initialization - + SYNOPSIS randominit() rand_st OUT Structure to initialize seed1 IN First initialization parameter seed2 IN Second initialization parameter - + RETURN none */ - + void randominit(struct rand_struct *rand_st,ulong seed1, ulong seed2) { /* For mysql 3.21.# */ #ifdef HAVE_purify @@ -95,12 +95,12 @@ void randominit(struct rand_struct *rand_st,ulong seed1, ulong seed2) /* Old (MySQL 3.20) random generation structure initialization - + SYNOPSIS old_randominit() rand_st OUT Structure to initialize seed1 IN First initialization parameter - + RETURN none */ @@ -116,11 +116,11 @@ static void old_randominit(struct rand_struct *rand_st,ulong seed1) /* Generate Random number - + SYNOPSIS rnd() rand_st INOUT Structure used for number generation - + RETURN Generated pseudo random number */ @@ -136,13 +136,13 @@ double rnd(struct rand_struct *rand_st) /* Generate String of printable random characters of requested length String will not be zero terminated. - + SYNOPSIS create_random_string() - length IN Lenght of + length IN Lenght of rand_st INOUT Structure used for number generation target OUT Buffer for generation - + RETURN none */ @@ -153,7 +153,7 @@ void create_random_string(int length,struct rand_struct *rand_st,char* target) /* Use pointer arithmetics as it is faster way to do so. */ while (target<end) { - *target=rnd(rand_st)*94+33; + *target=rnd(rand_st)*94+33; target++; } } @@ -162,22 +162,22 @@ void create_random_string(int length,struct rand_struct *rand_st,char* target) /* Encrypt/Decrypt function used for password encryption in authentication Simple XOR is used here but it is OK as we crypt random strings - + SYNOPSIS password_crypt() from IN Data for encryption to OUT Encrypt data to the buffer (may be the same) - password IN Password used for encryption (same length) + password IN Password used for encryption (same length) length IN Length of data to encrypt - + RETURN none */ -void password_crypt(const char* from,char* to, const char* password,int length) +void password_crypt(const char* from,char* to, const char* password,int length) { const char *from_end=from+length; - + while (from < from_end) *to++= *(from++) ^* (password++); } @@ -186,12 +186,12 @@ void password_crypt(const char* from,char* to, const char* password,int length) /* Generate binary hash from raw text password Used for Pre-4.1 Password handling - + SYNOPSIS hash_pasword() result OUT Store hash in this location password IN Plain text password to build hash - + RETURN none */ @@ -216,66 +216,66 @@ void hash_password(ulong *result, const char *password) /* - Stage one password hashing. + Stage one password hashing. Used in MySQL 4.1 password handling - + SYNOPSIS password_hash_stage1() to OUT Store stage one hash to this location password IN Plain text password to build hash - + RETURN none */ void password_hash_stage1(char *to, const char *password) { - SHA1_CONTEXT context; + SHA1_CONTEXT context; sha1_reset(&context); for (; *password ; password++) { - if (*password == ' ' || *password == '\t') + if (*password == ' ' || *password == '\t') continue;/* skip space in password */ - sha1_input(&context,(int8*)&password[0],1); + sha1_input(&context,(int8*)&password[0],1); } - sha1_result(&context,(uint8*)to); + sha1_result(&context,(uint8*)to); } /* - Stage two password hashing. + Stage two password hashing. Used in MySQL 4.1 password handling - + SYNOPSIS password_hash_stage2() to INOUT Use this as stage one hash and store stage two hash here salt IN Salt used for stage two hashing - + RETURN none */ void password_hash_stage2(char *to,const char *salt) { - SHA1_CONTEXT context; + SHA1_CONTEXT context; sha1_reset(&context); sha1_input(&context,(uint8*)salt,4); sha1_input(&context,to,SHA1_HASH_SIZE); - sha1_result(&context,(uint8*)to); + sha1_result(&context,(uint8*)to); } /* Create password to be stored in user database from raw string - Handles both MySQL 4.1 and Pre-MySQL 4.1 passwords - + Handles both MySQL 4.1 and Pre-MySQL 4.1 passwords + SYNOPSIS make_scramble_password() - to OUT Store scrambled password here + to OUT Store scrambled password here password IN Raw string password - force_old_scramle + force_old_scramle IN Force generation of old scramble variant - rand_st INOUT Structure for temporary number generation. + rand_st INOUT Structure for temporary number generation. RETURN none */ @@ -283,7 +283,7 @@ void password_hash_stage2(char *to,const char *salt) void make_scrambled_password(char *to,const char *password, my_bool force_old_scramble, struct rand_struct *rand_st) -{ +{ ulong hash_res[2]; /* Used for pre 4.1 password hashing */ unsigned short salt; /* Salt for 4.1 version password */ uint8 digest[SHA1_HASH_SIZE]; @@ -292,37 +292,37 @@ void make_scrambled_password(char *to,const char *password, hash_password(hash_res,password); sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]); } - else /* New password 4.1 password scrambling */ + else /* New password 4.1 password scrambling */ { to[0]=PVERSION41_CHAR; /* New passwords have version prefix */ /* Random returns number from 0 to 1 so this would be good salt generation.*/ - salt=rnd(rand_st)*65535+1; - /* Use only 2 first bytes from it */ + salt=rnd(rand_st)*65535+1; + /* Use only 2 first bytes from it */ sprintf(to+1,"%04x",salt); /* First hasing is done without salt */ password_hash_stage1(digest,password); /* Second stage is done with salt */ - password_hash_stage2(digest,(char*)to+1), + password_hash_stage2(digest,(char*)to+1), /* Print resulting hash into the password*/ sprintf(to+5, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", digest[0],digest[1],digest[2],digest[3],digest[4],digest[5],digest[6], digest[7],digest[8],digest[9],digest[10],digest[11],digest[12],digest[13], - digest[14],digest[15],digest[16],digest[17],digest[18],digest[19]); + digest[14],digest[15],digest[16],digest[17],digest[18],digest[19]); } } /* - Convert password from binary string form to salt form + Convert password from binary string form to salt form Used for MySQL 4.1 password handling - + SYNOPSIS get_salt_from_bin_password() res OUT Store salt form password here password IN Binary password to be converted salt IN hashing-salt to be used for salt form generation - + RETURN none */ @@ -332,7 +332,7 @@ void get_salt_from_bin_password(ulong *res,unsigned char *password,ulong salt) unsigned char* password_end=password+SCRAMBLE41_LENGTH; *res=salt; res++; - + /* Process password of known length*/ while (password<password_end) { @@ -341,19 +341,19 @@ void get_salt_from_bin_password(ulong *res,unsigned char *password,ulong salt) for (i=0 ; i < 4 ; i++) val=(val << 8)+(*password++); *res++=val; - } + } } /* - Validate password for MySQL 4.1 password handling. - + Validate password for MySQL 4.1 password handling. + SYNOPSIS validate_password() password IN Encrypted Scramble which we got from the client message IN Original scramble which we have sent to the client before - salt IN Password in the salted form to match to - + salt IN Password in the salted form to match to + RETURN 0 for correct password !0 for invalid password @@ -367,34 +367,34 @@ my_bool validate_password(const char* password, const char* message, ulong salt_candidate[6]; /* Computed candidate salt */ ulong* sc=salt_candidate; /* we need to be able to increment */ ulong* salt_end; - + /* Now we shall get stage1 encrypted password in buffer*/ password_crypt(password,buffer,message,SCRAMBLE41_LENGTH); - + /* For compatibility reasons we use ulong to store salt while we need char */ sprintf(tmpsalt,"%04x",(unsigned short)salt[0]); - + password_hash_stage2(buffer,tmpsalt); /* Convert password to salt to compare */ get_salt_from_bin_password(salt_candidate,buffer,salt[0]); - - /* Now we shall get exactly the same password as we have stored for user */ + + /* Now we shall get exactly the same password as we have stored for user */ for (salt_end=salt+5 ; salt < salt_end; ) if (*++salt != *++sc) return 1; - - /* Or password correct*/ + + /* Or password correct*/ return 0; -} +} /* Get length of password string which is stored in mysql.user table - + SYNOPSIS get_password_length() - force_old_scramble IN If we wish to use pre 4.1 scramble format - + force_old_scramble IN If we wish to use pre 4.1 scramble format + RETURN password length >0 */ @@ -407,11 +407,11 @@ int get_password_length(my_bool force_old_scramble) /* Get version of the password based on mysql.user password string - + SYNOPSIS get_password_version() password IN Password string as stored in mysql.user - + RETURN 0 for pre 4.1 passwords !0 password version char for newer passwords @@ -419,19 +419,19 @@ int get_password_length(my_bool force_old_scramble) char get_password_version(const char* password) { - if (password==NULL) return 0; + if (password==NULL) return 0; if (password[0]==PVERSION41_CHAR) return PVERSION41_CHAR; return 0; } /* - Get integer value of Hex character - + Get integer value of Hex character + SYNOPSIS char_val() X IN Character to find value for - + RETURN Appropriate integer value */ @@ -448,18 +448,18 @@ inline uint char_val(char X) /* Get Binary salt from password as in mysql.user format - + SYNOPSIS get_salt_from_password() res OUT Store binary salt here password IN Password string as stored in mysql.user - + RETURN none - + NOTE This function does not have length check for passwords. It will just crash - Password hashes in old format must have length divisible by 8 + Password hashes in old format must have length divisible by 8 */ void get_salt_from_password(ulong *res,const char *password) @@ -471,18 +471,18 @@ void get_salt_from_password(ulong *res,const char *password) uint val=0; uint i; password++; /* skip version identifier */ - + /*get hashing salt from password and store in in the start of array */ for (i=0 ; i < 4 ; i++) val=(val << 4)+char_val(*password++); - *res++=val; + *res++=val; } /* We process old passwords the same way as new ones in other case */ #ifdef EXTRA_DEBUG if (strlen(password)%8!=0) fprintf(stderr,"Warning: Incorrect password length for salting: %d\n", - strlen(password)); -#endif + strlen(password)); +#endif while (*password) { ulong val=0; @@ -490,7 +490,7 @@ void get_salt_from_password(ulong *res,const char *password) for (i=0 ; i < 8 ; i++) val=(val << 4)+char_val(*password++); *res++=val; - } + } } return; } @@ -498,14 +498,14 @@ void get_salt_from_password(ulong *res,const char *password) /* Get string version as stored in mysql.user from salt form - + SYNOPSIS make_password_from_salt() to OUT Store resulting string password here hash_res IN Password in salt format password_version IN According to which version salt should be treated - + RETURN none */ @@ -526,14 +526,14 @@ void make_password_from_salt(char *to, ulong *hash_res,uint8 password_version) /* Convert password in salted form to binary string password and hash-salt For old password this involes one more hashing - + SYNOPSIS get_hash_and_password() salt IN Salt to convert from pversion IN Password version to use - hash OUT Store zero ended hash here + hash OUT Store zero ended hash here bin_password OUT Store binary password here (no zero at the end) - + RETURN 0 for pre 4.1 passwords !0 password version char for newer passwords @@ -544,9 +544,9 @@ void get_hash_and_password(ulong* salt, uint8 pversion, char* hash, unsigned cha int t; ulong* salt_end; ulong val; - SHA1_CONTEXT context; + SHA1_CONTEXT context; unsigned char* bp; /* Binary password loop pointer */ - + if (pversion) /* New password version assumed */ { salt_end=salt+5; @@ -559,13 +559,13 @@ void get_hash_and_password(ulong* salt, uint8 pversion, char* hash, unsigned cha bin_password[t]=val%256; val>>=8; /* Scroll 8 bits to get next part*/ } - bin_password+=4; /* Get to next 4 chars*/ + bin_password+=4; /* Get to next 4 chars*/ } } - else + else { /* Use zero starting hash as an indication of old password */ - hash[0]=0; + hash[0]=0; salt_end=salt+2; bp=bin_password; /* Encode salt using SHA1 here */ @@ -576,28 +576,28 @@ void get_hash_and_password(ulong* salt, uint8 pversion, char* hash, unsigned cha for(t=3;t>=0;t--) { bp[t]=val%256; - + val>>=8; /* Scroll 8 bits to get next part*/ } - bp+=4; /* Get to next 4 chars*/ + bp+=4; /* Get to next 4 chars*/ salt++; } /* Use 8 bytes of binary password for hash */ - sha1_input(&context,(uint8*)bin_password,8); - sha1_result(&context,(uint8*)bin_password); - } + sha1_input(&context,(uint8*)bin_password,8); + sha1_result(&context,(uint8*)bin_password); + } } /* - Create key from old password to decode scramble + Create key from old password to decode scramble Used in 4.1 authentication with passwords stored old way - + SYNOPSIS create_key_from_old_password() passwd IN Password used for key generation - key OUT Created 20 bytes key - + key OUT Created 20 bytes key + RETURN None */ @@ -615,35 +615,35 @@ void create_key_from_old_password(const char* passwd, char* key) get_hash_and_password(salt,0,buffer,(unsigned char*) key); } - + /* - Scramble string with password + Scramble string with password Used at pre 4.1 authentication phase. - + SYNOPSIS scramble() to OUT Store scrambled message here message IN Message to scramble password IN Password to use while scrambling old_ver IN Forse old version random number generator - + RETURN End of scrambled string */ - + char *scramble(char *to,const char *message,const char *password, my_bool old_ver) { struct rand_struct rand_st; ulong hash_pass[2],hash_message[2]; char message_buffer[9]; /* Real message buffer */ - char* msg=message_buffer; - + char* msg=message_buffer; + /* We use special message buffer now as new server can provide longer hash */ - + memcpy(message_buffer,message,8); message_buffer[8]=0; - + if (password && password[0]) { char *to_start=to; @@ -669,16 +669,16 @@ char *scramble(char *to,const char *message,const char *password, /* - Check scrambled message + Check scrambled message Used for pre 4.1 password handling - + SYNOPSIS scramble() scrambled IN Scrambled message to check message IN Original message which was scramble hash_pass IN Password which should be used for scrambling old_ver IN Forse old version random number generator - + RETURN 0 Password correct !0 Password invalid @@ -695,7 +695,7 @@ my_bool check_scramble(const char *scrambled, const char *message, memcpy(message_buffer,message,8); /* Old auth uses 8 bytes at maximum */ message_buffer[8]=0; - + hash_password(hash_message,message_buffer); if (old_ver) old_randominit(&rand_st,hash_pass[0] ^ hash_message[0]); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index be4c791c71d..ed4f1387fa9 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -654,7 +654,7 @@ check_connections(THD *thd) if (user) strmake(tmp_user,user,USERNAME_LENGTH); - tmp_db[0]=0; + tmp_db[0]=0; if (db) strmake(tmp_db,db,NAME_LEN); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index a56ed20f7be..c860d98bcc4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -547,7 +547,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %type <lex_str> IDENT TEXT_STRING REAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM LEX_HOSTNAME - ULONGLONG_NUM field_ident select_alias ident ident_or_text + ULONGLONG_NUM field_ident select_alias ident ident_or_text UNDERSCORE_CHARSET %type <lex_str_ptr> @@ -561,7 +561,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); opt_escape %type <string> - text_string + text_string %type <num> type int_type real_type order_dir opt_field_spec lock_option @@ -626,7 +626,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %type <lex_user> user grant_user -%type <charset> +%type <charset> charset_name charset_name_or_default opt_db_default_character_set @@ -642,7 +642,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); insert_values update delete truncate rename show describe load alter optimize flush reset purge begin commit rollback slave master_def master_defs - repair restore backup analyze check + repair restore backup analyze check field_list field_list_item field_spec kill select_item_list select_item values_list no_braces opt_limit_clause delete_limit_clause fields opt_values values @@ -712,7 +712,7 @@ verb_clause: | lock | kill | optimize - | purge + | purge | rename | repair | replace @@ -730,10 +730,10 @@ verb_clause: | update | use | help; - + /* help */ -help: +help: HELP TEXT_STRING { LEX *lex= Lex; @@ -842,7 +842,7 @@ create: lex->col_list.empty(); lex->change=NullS; } - '(' key_list ')' + '(' key_list ')' { LEX *lex=Lex; @@ -951,12 +951,12 @@ create_table_option: lex->create_info.used_fields|= HA_CREATE_USED_UNION; } | opt_default CHARSET opt_equal charset_name_or_default - { + { Lex->create_info.table_charset= $4; Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET; } | opt_default CHAR_SYM SET opt_equal charset_name_or_default - { + { Lex->create_info.table_charset= $5; Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET; } @@ -1091,7 +1091,7 @@ type: if (YYTHD->sql_mode & MODE_SAPDB) $$=FIELD_TYPE_DATETIME; else - $$=FIELD_TYPE_TIMESTAMP; + $$=FIELD_TYPE_TIMESTAMP; } | TIMESTAMP '(' NUM ')' { Lex->length=$3.str; $$=FIELD_TYPE_TIMESTAMP; } @@ -1265,7 +1265,7 @@ opt_primary: references: REFERENCES table_ident { - LEX *lex=Lex; + LEX *lex=Lex; lex->fk_delete_opt= lex->fk_update_opt= lex->fk_match_option= 0; lex->ref_list.empty(); } @@ -1273,7 +1273,7 @@ references: { $$=$2; }; - + opt_ref_list: /* empty */ opt_on_delete {} | '(' ref_list ')' opt_on_delete {}; @@ -1517,11 +1517,11 @@ slave_thread_opts: | slave_thread_opts ',' slave_thread_opt; slave_thread_opt: - /*empty*/ {} + /*empty*/ {} | SQL_THREAD { Lex->slave_thd_opt|=SLAVE_SQL; } | IO_THREAD { Lex->slave_thd_opt|=SLAVE_IO; } ; - + restore: RESTORE_SYM table_or_tables { @@ -1808,7 +1808,7 @@ expr_expr: | expr IN_SYM in_subselect { $$= new Item_in_subselect(YYTHD, $1, $3); } | expr NOT IN_SYM in_subselect - { + { $$= new Item_func_not(new Item_in_subselect(YYTHD, $1, $4)); } | expr BETWEEN_SYM no_and_expr AND expr @@ -1829,7 +1829,7 @@ expr_expr: | expr comp_op expr %prec EQ { $$= (*((*$2)(0)))($1,$3); } | expr comp_op all_or_any in_subselect %prec EQ { - Item_allany_subselect *it= + Item_allany_subselect *it= new Item_allany_subselect(YYTHD, $1, (*$2)($3), $4); if ($3) $$ = new Item_func_not(it); /* ALL */ @@ -1845,7 +1845,7 @@ expr_expr: | expr DIV_SYM expr { $$= new Item_func_int_div($1,$3); } | expr MOD_SYM expr { $$= new Item_func_mod($1,$3); } | expr '|' expr { $$= new Item_func_bit_or($1,$3); } - | expr '^' expr { $$= new Item_func_bit_xor($1,$3); } + | expr '^' expr { $$= new Item_func_bit_xor($1,$3); } | expr '&' expr { $$= new Item_func_bit_and($1,$3); } | expr '%' expr { $$= new Item_func_mod($1,$3); } | expr '+' INTERVAL_SYM expr interval @@ -1875,7 +1875,7 @@ no_in_expr: | no_in_expr comp_op expr %prec EQ { $$= (*((*$2)(0)))($1,$3); } | no_in_expr comp_op all_or_any in_subselect %prec EQ { - Item_allany_subselect *it= + Item_allany_subselect *it= new Item_allany_subselect(YYTHD, $1, (*$2)($3), $4); if ($3) $$ = new Item_func_not(it); /* ALL */ @@ -1909,7 +1909,7 @@ no_and_expr: | no_and_expr IN_SYM in_subselect { $$= new Item_in_subselect(YYTHD, $1, $3); } | no_and_expr NOT IN_SYM in_subselect - { + { $$= new Item_func_not(new Item_in_subselect(YYTHD, $1, $4)); } | no_and_expr BETWEEN_SYM no_and_expr AND expr @@ -1929,7 +1929,7 @@ no_and_expr: | no_and_expr comp_op expr %prec EQ { $$= (*((*$2)(0)))($1,$3); } | no_and_expr comp_op all_or_any in_subselect %prec EQ { - Item_allany_subselect *it= + Item_allany_subselect *it= new Item_allany_subselect(YYTHD, $1, (*$2)($3), $4); if ($3) $$ = new Item_func_not(it); /* ALL */ @@ -1963,7 +1963,7 @@ simple_expr: $$= new Item_func_set_user_var($2,$4); Lex->safe_to_cache_query=0; } - | '@' ident_or_text + | '@' ident_or_text { $$= new Item_func_get_user_var($2); Lex->safe_to_cache_query=0; @@ -2031,8 +2031,8 @@ simple_expr: | CURTIME optional_braces { $$= new Item_func_curtime(); Lex->safe_to_cache_query=0; } | CURTIME '(' expr ')' - { - $$= new Item_func_curtime($3); + { + $$= new Item_func_curtime($3); Lex->safe_to_cache_query=0; } | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' @@ -2040,9 +2040,9 @@ simple_expr: | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' { $$= new Item_date_add_interval($3,$6,$7,1); } | DATABASE '(' ')' - { + { $$= new Item_func_database(); - Lex->safe_to_cache_query=0; + Lex->safe_to_cache_query=0; } | ELT_FUNC '(' expr ',' expr_list ')' { $$= new Item_func_elt($3, *$5); } @@ -2051,7 +2051,7 @@ simple_expr: | ENCRYPT '(' expr ')' { $$= new Item_func_encrypt($3); - Lex->safe_to_cache_query=0; + Lex->safe_to_cache_query=0; } | ENCRYPT '(' expr ',' expr ')' { $$= new Item_func_encrypt($3,$5); } | DECODE_SYM '(' expr ',' TEXT_STRING ')' @@ -2089,8 +2089,8 @@ simple_expr: | GEOMFROMTEXT '(' expr ',' expr ')' { $$= new Item_func_geometry_from_text($3); } | GEOMETRYCOLLECTION '(' expr_list ')' - { $$= new Item_func_spatial_collection(* $3, - Geometry::wkbGeometryCollection, + { $$= new Item_func_spatial_collection(* $3, + Geometry::wkbGeometryCollection, Geometry::wkbPoint); } | HOUR_SYM '(' expr ')' { $$= new Item_func_hour($3); } @@ -2116,7 +2116,7 @@ simple_expr: | LEFT '(' expr ',' expr ')' { $$= new Item_func_left($3,$5); } | LINESTRING '(' expr_list ')' - { $$= new Item_func_spatial_collection(* $3, + { $$= new Item_func_spatial_collection(* $3, Geometry::wkbLineString, Geometry::wkbPoint); } | LOCATE '(' expr ',' expr ')' { $$= new Item_func_locate($5,$3); } @@ -2145,7 +2145,7 @@ simple_expr: | MONTH_SYM '(' expr ')' { $$= new Item_func_month($3); } | MULTILINESTRING '(' expr_list ')' - { $$= new Item_func_spatial_collection(* $3, + { $$= new Item_func_spatial_collection(* $3, Geometry::wkbMultiLineString, Geometry::wkbLineString); } | MLINEFROMTEXT '(' expr ')' { $$= new Item_func_geometry_from_text($3); } @@ -2160,10 +2160,10 @@ simple_expr: | MPOLYFROMTEXT '(' expr ',' expr ')' { $$= new Item_func_geometry_from_text($3); } | MULTIPOINT '(' expr_list ')' - { $$= new Item_func_spatial_collection(* $3, + { $$= new Item_func_spatial_collection(* $3, Geometry::wkbMultiPoint, Geometry::wkbPoint); } | MULTIPOLYGON '(' expr_list ')' - { $$= new Item_func_spatial_collection(* $3, + { $$= new Item_func_spatial_collection(* $3, Geometry::wkbMultiPolygon, Geometry::wkbPolygon ); } | NOW_SYM optional_braces { $$= new Item_func_now(); Lex->safe_to_cache_query=0;} @@ -2182,7 +2182,7 @@ simple_expr: | POLYFROMTEXT '(' expr ',' expr ')' { $$= new Item_func_geometry_from_text($3); } | POLYGON '(' expr_list ')' - { $$= new Item_func_spatial_collection(* $3, + { $$= new Item_func_spatial_collection(* $3, Geometry::wkbPolygon, Geometry::wkbLineString); } | POSITION_SYM '(' no_in_expr IN_SYM expr ')' { $$ = new Item_func_locate($5,$3); } @@ -2266,7 +2266,7 @@ simple_expr: $$ = new Item_func_udf_int($1); } | UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' expr_list ')' - { + { $$= new Item_func_unique_users($3,atoi($5.str),atoi($7.str), * $9); } | UNIX_TIMESTAMP '(' ')' @@ -2289,7 +2289,7 @@ simple_expr: | YEARWEEK '(' expr ',' expr ')' { $$= new Item_func_yearweek($3, $5); } | BENCHMARK_SYM '(' ULONG_NUM ',' expr ')' - { + { $$=new Item_func_benchmark($3,$5); Lex->safe_to_cache_query=0; } @@ -2330,7 +2330,7 @@ in_sum_expr: if (lex->current_select->inc_in_sum_expr()) { send_error(lex->thd, ER_SYNTAX_ERROR); - YYABORT; + YYABORT; } } expr @@ -2389,7 +2389,7 @@ when_list: when_list2: expr THEN_SYM expr { - SELECT_LEX_NODE *sel=Select; + SELECT_LEX_NODE *sel=Select; sel->when_list.head()->push_back($1); sel->when_list.head()->push_back($3); } @@ -2483,7 +2483,7 @@ select_derived: { LEX *lex= Lex; lex->derived_tables= true; - if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE || + if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE || mysql_new_select(lex, 1)) YYABORT; mysql_init_select(lex); @@ -2574,7 +2574,7 @@ opt_table_alias: where_clause: - /* empty */ { Select->select_lex()->where= 0; } + /* empty */ { Select->select_lex()->where= 0; } | WHERE expr { Select->select_lex()->where= $2; @@ -2654,8 +2654,8 @@ opt_order_clause: | order_clause; order_clause: - ORDER_SYM BY - { + ORDER_SYM BY + { LEX *lex=Lex; if (lex->current_select->linkage != GLOBAL_OPTIONS_TYPE && lex->current_select->select_lex()->olap != @@ -2686,7 +2686,7 @@ opt_limit_clause: ; limit_clause: - LIMIT + LIMIT { LEX *lex= Lex; if (lex->current_select->linkage != GLOBAL_OPTIONS_TYPE && @@ -2785,7 +2785,7 @@ select_var_list_init: if (!lex->describe && (!(lex->result= new select_dumpvar()))) YYABORT; } - select_var_list + select_var_list ; select_var_list: @@ -2835,7 +2835,7 @@ into: DO statement */ -do: DO_SYM +do: DO_SYM { LEX *lex=Lex; lex->sql_command = SQLCOM_DO; @@ -3105,7 +3105,7 @@ opt_low_priority: delete: DELETE_SYM - { + { LEX *lex= Lex; lex->sql_command= SQLCOM_DELETE; lex->select_lex.options= 0; @@ -3150,7 +3150,7 @@ table_wild_one: ; opt_wild: - /* empty */ {} + /* empty */ {} | '.' '*' {}; @@ -3175,11 +3175,11 @@ truncate: opt_table_sym: /* empty */ | TABLE_SYM; - + /* Show things */ -show: SHOW - { +show: SHOW + { LEX *lex=Lex; lex->wild=0; bzero((char*) &lex->create_info,sizeof(lex->create_info)); @@ -3218,7 +3218,7 @@ show_param: if (!Select->add_table_to_list($4, NULL, 0)) YYABORT; } - | NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ + | NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ TEXT_STRING AND MASTER_LOG_POS_SYM EQ ulonglong_num AND MASTER_SERVER_ID_SYM EQ ULONG_NUM @@ -3266,14 +3266,14 @@ show_param: LEX *lex=Lex; lex->sql_command= SQLCOM_SHOW_PRIVILEGES; } - | COUNT_SYM '(' '*' ')' WARNINGS + | COUNT_SYM '(' '*' ')' WARNINGS { (void) create_select_for_variable("warning_count"); } - | COUNT_SYM '(' '*' ')' ERRORS + | COUNT_SYM '(' '*' ')' ERRORS { (void) create_select_for_variable("error_count"); } | WARNINGS {Select->offset_limit=0L;} opt_limit_clause { Lex->sql_command = SQLCOM_SHOW_WARNS;} | ERRORS {Select->offset_limit=0L;} opt_limit_clause - { Lex->sql_command = SQLCOM_SHOW_ERRORS;} + { Lex->sql_command = SQLCOM_SHOW_ERRORS;} | STATUS_SYM wild { Lex->sql_command= SQLCOM_SHOW_STATUS; } | INNOBASE_SYM STATUS_SYM @@ -3356,9 +3356,9 @@ describe: } opt_describe_column | describe_command { Lex->describe=1; } select - { + { LEX *lex=Lex; - lex->select_lex.options|= SELECT_DESCRIBE; + lex->select_lex.options|= SELECT_DESCRIBE; }; @@ -3438,7 +3438,7 @@ kill: { LEX *lex=Lex; if ($2->check_cols(1) || $2->fix_fields(lex->thd, 0, &$2)) - { + { send_error(lex->thd, ER_SET_CONSTANTS_ONLY); YYABORT; } @@ -3554,15 +3554,15 @@ text_string: $$= tmp ? tmp->val_str((String*) 0) : (String*) 0; }; param_marker: - '?' + '?' { LEX *lex=Lex; if (YYTHD->prepare_command) - { - lex->param_list.push_back($$=new Item_param()); + { + lex->param_list.push_back($$=new Item_param()); lex->param_count++; } - else + else { yyerror("You have an error in your SQL syntax"); YYABORT; @@ -3932,7 +3932,7 @@ isolation_types: | REPEATABLE_SYM READ_SYM { $$= ISO_REPEATABLE_READ; } | SERIALIZABLE_SYM { $$= ISO_SERIALIZABLE; } ; - + text_or_password: TEXT_STRING { $$=$1.str;} | PASSWORD '(' TEXT_STRING ')' @@ -4170,7 +4170,7 @@ require_list_element: lex->ssl_cipher=$2.str; } ; - + opt_table: '*' { @@ -4286,7 +4286,7 @@ column_list_id: require_clause: /* empty */ - | REQUIRE_SYM require_list + | REQUIRE_SYM require_list { Lex->ssl_type=SSL_TYPE_SPECIFIED; } @@ -4366,7 +4366,7 @@ union_list: /* Only the last SELECT can have INTO...... */ net_printf(lex->thd, ER_WRONG_USAGE, "UNION", "INTO"); YYABORT; - } + } if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) { send_error(lex->thd, ER_SYNTAX_ERROR); @@ -4385,7 +4385,7 @@ union_opt: ; optional_order_or_limit: - /* Empty */ {} + /* Empty */ {} | { LEX *lex=Lex; @@ -4395,7 +4395,7 @@ optional_order_or_limit: YYABORT; } SELECT_LEX *sel= lex->current_select->select_lex(); - sel->master_unit()->global_parameters= + sel->master_unit()->global_parameters= sel->master_unit(); lex->current_select= sel->master_unit(); lex->current_select->select_limit= |