Skip to content

Commit

Permalink
lower casing service names, looping in login menu
Browse files Browse the repository at this point in the history
  • Loading branch information
limpkin committed Apr 29, 2015
1 parent b73539c commit 9116478
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 8 deletions.
Binary file modified source_code/Mooltipass.atsuo
Binary file not shown.
24 changes: 21 additions & 3 deletions source_code/src/GUI/gui_credentials_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ uint8_t displayCurrentSearchLoginTexts(char* text, uint16_t* resultsarray)
{
uint16_t tempNodeAddr;
pNode temp_pnode;
uint8_t i;
uint8_t i, j;

// Set font for search text
oledSetFont(FONT_PROFONT_18);
Expand All @@ -384,6 +384,7 @@ uint8_t displayCurrentSearchLoginTexts(char* text, uint16_t* resultsarray)
// Find the address of the first match
tempNodeAddr = searchForServiceName((uint8_t*)text, COMPARE_MODE_COMPARE, SERVICE_CRED_TYPE);

// Only change display if the first displayed service changed
if (tempNodeAddr != last_matching_parent_addr)
{
last_matching_parent_addr = tempNodeAddr;
Expand All @@ -395,13 +396,30 @@ uint8_t displayCurrentSearchLoginTexts(char* text, uint16_t* resultsarray)

// Print the next 4 services
i = 0;
while ((tempNodeAddr != NODE_ADDR_NULL) && (i != 4))
uint8_t temp_bool = TRUE;
while ((temp_bool != FALSE) && (i != 4))
{
resultsarray[i] = tempNodeAddr;
readParentNode(&temp_pnode, tempNodeAddr);
displayServiceAtGivenSlot(i, (const char*)temp_pnode.service);
tempNodeAddr = temp_pnode.nextParentAddress;
// Loop around
if (temp_pnode.nextParentAddress == NODE_ADDR_NULL)
{
tempNodeAddr = getStartingParentAddress();
}
else
{
tempNodeAddr = temp_pnode.nextParentAddress;
}
i++;
// Check that we haven't already displayed the next node
for (j = 0; j < i; j++)
{
if (resultsarray[j] == tempNodeAddr)
{
temp_bool = FALSE;
}
}
}

// Store and return number of children
Expand Down
10 changes: 9 additions & 1 deletion source_code/src/GUI/gui_screen_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,15 @@ void guiScreenLoop(uint8_t touch_detect_result)
else if (state_machine_val == (SCREEN_DEFAULT_INSERTED_NLCK|TOUCHPOS_WHEEL_TLEFT))
{
// User wants to go to the login menu
loginSelectLogic();
if (getStartingParentAddress() != NODE_ADDR_NULL)
{
loginSelectLogic();
}
else
{
guiDisplayInformationOnScreen(ID_STRING_NO_CREDS);
userViewDelay();
}
guiGetBackToCurrentScreen();
}
else if (state_machine_val == (SCREEN_SETTINGS|TOUCHPOS_WHEEL_BLEFT))
Expand Down
4 changes: 2 additions & 2 deletions source_code/src/LOGIC/logic_aes_and_comms.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ uint16_t searchForServiceName(uint8_t* name, uint8_t mode, uint8_t type)
}
while (next_node_addr != NODE_ADDR_NULL);

// We didn't find the service
return NODE_ADDR_NULL;
// We didn't find the service, return first node
return getStartingParentAddress();
}
}

Expand Down
25 changes: 23 additions & 2 deletions source_code/src/USB/usb_cmd_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include "node_mgmt.h"
#include "flash_mem.h"
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include "delays.h"
#include "oledmp.h"
#include "utils.h"
Expand Down Expand Up @@ -154,6 +156,19 @@ void leaveMemoryManagementMode(void)
}
#endif

/*! \fn lowerCaseString(char* data)
* \brief lower case a string
* \param data String to be lowercased
*/
void lowerCaseString(uint8_t* data)
{
while(*data)
{
*data = tolower(*data);
data++;
}
}

/*! \fn checkTextField(uint8_t* data, uint8_t len)
* \brief Check that the sent text is correct
* \param data Pointer to the data
Expand All @@ -162,13 +177,19 @@ void leaveMemoryManagementMode(void)
* \return If the sent text is ok
*/
RET_TYPE checkTextField(uint8_t* data, uint8_t len, uint8_t max_len)
{
{
// Check that the advertised length is correct, that it is not null and isn't bigger than a data packet
if ((len > max_len) || (len == 0) || (len != strlen((char*)data)+1) || (len > (RAWHID_RX_SIZE-HID_DATA_START)))
{
return RETURN_NOK;
}
else
{
// lower case string in case of service
if (max_len == NODE_PARENT_SIZE_OF_SERVICE)
{
lowerCaseString(data);
}
return RETURN_OK;
}
}
Expand Down Expand Up @@ -275,7 +296,7 @@ void usbProcessIncoming(uint8_t caller_id)
// Return an error that was defined before (ERROR)
usbSendMessage(datacmd, 1, &plugin_return_value);
return;
}
}

// Check that we are in node mangement mode when needed
if ((datacmd >= FIRST_CMD_FOR_DATAMGMT) && (datacmd <= LAST_CMD_FOR_DATA8MGMT) && (memoryManagementModeApproved == FALSE))
Expand Down
2 changes: 2 additions & 0 deletions source_code/src/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
v1:
- possible Mooltipass freeze bug solved when inserting/removing smartcard
- possibility to cancel user input request boolean in eeprom
- lower casing all service names
- additional checks in read fav
- looping around in login menu

RC4:
- no screen flipping when no credentials for given service
Expand Down

0 comments on commit 9116478

Please sign in to comment.