apps/fsutils/passwd: Fix a few more errors found in integration

This commit is contained in:
Gregory Nutt 2016-01-20 14:41:27 -06:00
parent 681bfa2605
commit 29d65eb866
6 changed files with 20 additions and 9 deletions

View File

@ -86,12 +86,14 @@ struct passwd_s
*
****************************************************************************/
#if CONFIG_FS_WRITABLE
#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_FSUTILS_PASSWD_READONLY)
# define PASSWD_SEM_DECL(s) FAR sem_t *s
int passwd_lock(FAR sem_t **semp);
int passwd_unlock(FAR sem_t *sem);
#else
# define passwd_lock(semp) (0)
# define passwd_unlock(sem) (0)
# define PASSWD_SEM_DECL(s)
# define passwd_lock(semp) (0)
# define passwd_unlock(sem) (0)
#endif
/****************************************************************************

View File

@ -67,7 +67,7 @@
int passwd_adduser(FAR const char *username, FAR const char *password)
{
struct passwd_s passwd;
FAR sem_t *sem;
PASSWD_SEM_DECL(sem);
int ret;
/* Get exclusive access to the /etc/passwd file */

View File

@ -66,7 +66,7 @@
int passwd_deluser(FAR const char *username)
{
struct passwd_s passwd;
FAR sem_t *sem;
PASSWD_SEM_DECL(sem);
int ret;
/* Get exclusive access to the /etc/passwd file */

View File

@ -64,7 +64,7 @@
int passwd_update(FAR const char *username, FAR const char *password)
{
struct passwd_s passwd;
FAR sem_t *sem;
PASSWD_SEM_DECL(sem);
int ret;
/* Get exclusive access to the /etc/passwd file */

View File

@ -67,7 +67,7 @@ int passwd_verify(FAR const char *username, FAR const char *password)
{
struct passwd_s passwd;
char encrypted[MAX_ENCRYPTED + 1];
FAR sem_t *sem;
PASSWD_SEM_DECL(sem);
int ret;
/* Get exclusive access to the /etc/passwd file */

View File

@ -43,7 +43,15 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#if defined(CONFIG_FS_WRITABLE) && defined(CONFIG_FSUTILS_PASSWD_READONLY)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* passwd_verify() return value tests */
#define PASSWORD_VERIFY_MATCH(ret) (ret == 1)
#define PASSWORD_VERIFY_NOMATCH(ret) (ret == 0)
#define PASSWORD_VERIFY_ERROR(ret) (ret < 0)
/****************************************************************************
* Public Function Prototypes
@ -66,6 +74,7 @@
*
****************************************************************************/
#if defined(CONFIG_FS_WRITABLE) && defined(CONFIG_FSUTILS_PASSWD_READONLY)
int passwd_adduser(FAR const char *username, FAR const char *password);
/****************************************************************************
@ -104,6 +113,7 @@ int passwd_deluser(FAR const char *username);
****************************************************************************/
int passwd_update(FAR const char *username, FAR const char *password);
#endif /* CONFIG_FS_WRITABLE && CONFIG_FSUTILS_PASSWD_READONLY */
/****************************************************************************
* Name: passwd_verify
@ -125,5 +135,4 @@ int passwd_update(FAR const char *username, FAR const char *password);
int passwd_verify(FAR const char *username, FAR const char *password);
#endif /* CONFIG_FS_WRITABLE && CONFIG_FSUTILS_PASSWD_READONLY */
#endif /* __APPS_INCLUDE_FSUTILS_PASSWD_H */