int decode_password(char* pass, char* fname, char* ip, char* uname) { char code[9]; ulong map_size = 0; char* buf = NULL; char* data = NULL; char col[BUFSIZ]; int col_len = 0; getpassword(code, 8, "input encrypt code(8 char): "); map_size = map_file(fname, &buf); data = buf; while(*data != EOF) { // get ip if(col_cmp(data, ip) != 0) { data = next_line(data); continue; } // get username data = next_column(data); if(*data == EOF) break; if(col_cmp(data, uname) != 0) { data = next_line(data); continue; } // get password length data = next_column(data); col_len = column_length(data); strncpy(col, data, col_len); col[col_len] = '\0'; long p_len = atol(col); data += (col_len+1); memcpy(pass, data, p_len); pass[p_len] = '\0'; decode(pass, p_len, code); break; } munmap(buf, map_size); }
bool simple_ctable::iter::next(bool row) { if(row) number = base->column_count; else if(next_column()) return true; return advance(true); }
bool simple_ctable::iter::advance(bool initial) { for(;;) { if(!next_row(initial)) return false; if(next_column(true)) return true; if(!initial) source->next(); } }
static ResultExtraInfo *extra_info(drizzle_result_st *self_ptr) { buffer_column_if_needed(self_ptr); ResultExtraInfo *result = drizzle_alloc(ResultExtraInfo); int i, number_of_columns = drizzle_result_column_count(self_ptr); result->columns = malloc(sizeof(drizzle_column_st *) * (number_of_columns + 1)); for (i = 0; i < number_of_columns; i++) { result->columns[i] = next_column(self_ptr); } result->columns[number_of_columns] = NULL; return result; }
/* * This routine, given a pointer to a LINE, and the current cursor goal * column, return the best choice for the offset. The offset is returned. * Used by "C-N" and "C-P". */ int getgoal(LINE *dlp) { int col; int newcol; int dbo; col = 0; dbo = w_left_margin(curwp); while (dbo < llength(dlp)) { newcol = next_column(dlp, dbo, col); if (newcol > curgoal) break; col = newcol; dbo += BytesAt(dlp, dbo); } return (dbo); }