Remove dangle whitespace at the end of the line and some files with carriage returns in them
This commit is contained in:
parent
c98e51a31d
commit
8630130299
@ -3,7 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
|
@ -71,7 +71,7 @@ struct passwd_s
|
||||
/****************************************************************************
|
||||
* Name: passwd_lock and passwd_unlock
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Lock the /etc/passwd file. This is not a real lock at the level of the
|
||||
* file system. Rather, it only prevents concurrent modification of the
|
||||
* /etc/passwd file by passwd_adduser(), passwd_deluser(), and
|
||||
@ -97,7 +97,7 @@ int passwd_unlock(FAR sem_t *sem);
|
||||
/****************************************************************************
|
||||
* Name: passwd_encrypt
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Encrypt a password. Currently uses the Tiny Encryption Algorithm.
|
||||
*
|
||||
* Input Parameters:
|
||||
@ -114,7 +114,7 @@ int passwd_encrypt(FAR const char *password, char encrypted[MAX_ENCRYPTED + 1]);
|
||||
/****************************************************************************
|
||||
* Name: passwd_append
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Append a new record to the end of the /etc/passwd file
|
||||
*
|
||||
* Input Parameters:
|
||||
@ -130,7 +130,7 @@ int passwd_append(FAR const char *username, FAR const char *password);
|
||||
/****************************************************************************
|
||||
* Name: passwd_delete
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Delete on record from the password file at offset.
|
||||
*
|
||||
* Input Parameters:
|
||||
@ -146,8 +146,8 @@ int passwd_delete(off_t offset);
|
||||
/****************************************************************************
|
||||
* Name: passwd_find
|
||||
*
|
||||
* Description:
|
||||
* Find a password in the
|
||||
* Description:
|
||||
* Find a password in the
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
|
@ -50,7 +50,7 @@
|
||||
/****************************************************************************
|
||||
* Name: passwd_adduser
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Add a new user to the /etc/passwd file. If the user already exists,
|
||||
* then this function will fail with -EEXIST.
|
||||
*
|
||||
@ -98,7 +98,7 @@ int passwd_adduser(FAR const char *username, FAR const char *password)
|
||||
/* Return success */
|
||||
|
||||
ret = OK;
|
||||
|
||||
|
||||
errout_with_lock:
|
||||
(void)passwd_unlock(sem);
|
||||
return ret;
|
||||
|
@ -50,7 +50,7 @@
|
||||
/****************************************************************************
|
||||
* Name: passwd_append
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Append a new record to the end of the /etc/passwd file
|
||||
*
|
||||
* Input Parameters:
|
||||
@ -97,7 +97,7 @@ int passwd_append(FAR const char *username, FAR const char *password)
|
||||
/* Return success */
|
||||
|
||||
ret = OK;
|
||||
|
||||
|
||||
errout_with_stream:
|
||||
(void)fclose(stream);
|
||||
return ret;
|
||||
|
@ -54,7 +54,7 @@
|
||||
/****************************************************************************
|
||||
* Name: passwd_copyfile
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Copy copysize from instream to outstream (or until an error or EOF is
|
||||
* encountered)
|
||||
*
|
||||
@ -157,7 +157,7 @@ static int passwd_copyfile(FAR char *iobuffer, FILE *instream,
|
||||
/****************************************************************************
|
||||
* Name: passwd_delete
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Delete on record from the password file at offset.
|
||||
*
|
||||
* Input Parameters:
|
||||
@ -248,7 +248,7 @@ int passwd_delete(off_t offset)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Copy the rest of the file */
|
||||
|
||||
ret = passwd_copyfile(iobuffer, instream, outstream, SIZE_MAX);
|
||||
|
@ -50,7 +50,7 @@
|
||||
/****************************************************************************
|
||||
* Name: passwd_deluser
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Remove an existing user from the /etc/passwd file. If the user does
|
||||
* not exist, then this function will fail.
|
||||
*
|
||||
|
@ -68,7 +68,7 @@ static uint32_t g_tea_key[4] =
|
||||
/****************************************************************************
|
||||
* Name: passwd_encrypt
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Encrypt a password. Currently uses the Tiny Encryption Algorithm.
|
||||
*
|
||||
* Input Parameters:
|
||||
|
@ -53,8 +53,8 @@
|
||||
/****************************************************************************
|
||||
* Name: passwd_find
|
||||
*
|
||||
* Description:
|
||||
* Find a password in the
|
||||
* Description:
|
||||
* Find a password in the
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
|
@ -1,48 +1,48 @@
|
||||
/****************************************************************************
|
||||
* apps/fsutils/passwd/passwd_lock.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <semaphore.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "passwd.h"
|
||||
|
||||
/****************************************************************************
|
||||
* apps/fsutils/passwd/passwd_lock.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <semaphore.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "passwd.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@ -73,7 +73,7 @@ static sem_t g_passwd_sem = SEM_INITIALIZER(1);
|
||||
/****************************************************************************
|
||||
* Name: passwd_lock and passwd_unlock
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Lock the /etc/passwd file. This is not a real lock at the level of the
|
||||
* file system. Rather, it only prevents concurrent modification of the
|
||||
* /etc/passwd file by passwd_adduser(), passwd_deluser(), and
|
||||
@ -116,7 +116,7 @@ int passwd_lock(FAR sem_t **semp)
|
||||
DEBUGASSERT(errcode == EINTR);
|
||||
UNUSED(errcode);
|
||||
}
|
||||
|
||||
|
||||
*semp = sem;
|
||||
return OK;
|
||||
}
|
||||
@ -131,7 +131,7 @@ int passwd_unlock(FAR sem_t *sem)
|
||||
/* Close the named semaphore */
|
||||
|
||||
(void)sem_close(sem);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@
|
||||
/****************************************************************************
|
||||
* Name: passwd_update
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Change a new user to the /etc/passwd file. If the user does not exist,
|
||||
* then this function will fail.
|
||||
*
|
||||
|
@ -50,7 +50,7 @@
|
||||
/****************************************************************************
|
||||
* Name: passwd_verify
|
||||
*
|
||||
* Description:
|
||||
* Description:
|
||||
* Return true if the username exists in the /etc/passwd file and if the
|
||||
* password matches the user password in that faile.
|
||||
*
|
||||
|
@ -1,118 +1,118 @@
|
||||
/****************************************************************************
|
||||
* apps/include/fsutils/passwd.h
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_INCLUDE_FSUTILS_PASSWD_H
|
||||
#define __APPS_INCLUDE_FSUTILS_PASSWD_H 1
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: passwd_adduser
|
||||
*
|
||||
* Description:
|
||||
* Add a new user to the /etc/passwd file. If the user already exists,
|
||||
* then this function will fail with -EEXIST.
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int passwd_adduser(FAR const char *username, FAR const char *password);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: passwd_deluser
|
||||
*
|
||||
* Description:
|
||||
* Remove an existing user from the /etc/passwd file. If the user does
|
||||
* not exist, then this function will fail.
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int passwd_deluser(FAR const char *username, FAR const char *password);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: passwd_update
|
||||
*
|
||||
* Description:
|
||||
* Change a new user to the /etc/passwd file. If the user does not exist,
|
||||
* then this function will fail.
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int passwd_update(FAR const char *username, FAR const char *password);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: passwd_verify
|
||||
*
|
||||
* Description:
|
||||
* Return true if the username exists in the /etc/passwd file and if the
|
||||
* password matches the user password in that faile.
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* Returned Value:
|
||||
* One (1) is returned on success match, Zero (OK) is returned on an
|
||||
* unsuccessful match; a negated errno value is returned on any other
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int passwd_verify(FAR const char *username, FAR const char *password);
|
||||
|
||||
#endif /* __APPS_INCLUDE_FSUTILS_PASSWD_H */
|
||||
/****************************************************************************
|
||||
* apps/include/fsutils/passwd.h
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_INCLUDE_FSUTILS_PASSWD_H
|
||||
#define __APPS_INCLUDE_FSUTILS_PASSWD_H 1
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: passwd_adduser
|
||||
*
|
||||
* Description:
|
||||
* Add a new user to the /etc/passwd file. If the user already exists,
|
||||
* then this function will fail with -EEXIST.
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int passwd_adduser(FAR const char *username, FAR const char *password);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: passwd_deluser
|
||||
*
|
||||
* Description:
|
||||
* Remove an existing user from the /etc/passwd file. If the user does
|
||||
* not exist, then this function will fail.
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int passwd_deluser(FAR const char *username, FAR const char *password);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: passwd_update
|
||||
*
|
||||
* Description:
|
||||
* Change a new user to the /etc/passwd file. If the user does not exist,
|
||||
* then this function will fail.
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int passwd_update(FAR const char *username, FAR const char *password);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: passwd_verify
|
||||
*
|
||||
* Description:
|
||||
* Return true if the username exists in the /etc/passwd file and if the
|
||||
* password matches the user password in that faile.
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* Returned Value:
|
||||
* One (1) is returned on success match, Zero (OK) is returned on an
|
||||
* unsuccessful match; a negated errno value is returned on any other
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int passwd_verify(FAR const char *username, FAR const char *password);
|
||||
|
||||
#endif /* __APPS_INCLUDE_FSUTILS_PASSWD_H */
|
||||
|
Loading…
Reference in New Issue
Block a user