mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-30 19:53:46 +00:00
71 lines
2.2 KiB
C
71 lines
2.2 KiB
C
/*------------------------------------------------------------------
|
|
* safe_str_lib.h -- Safe C Library String APIs
|
|
*
|
|
* October 2008, Bo Berry
|
|
*
|
|
* Copyright (c) 2008-2011, 2013 by Cisco Systems, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person
|
|
* obtaining a copy of this software and associated documentation
|
|
* files (the "Software"), to deal in the Software without
|
|
* restriction, including without limitation the rights to use,
|
|
* copy, modify, merge, publish, distribute, sublicense, and/or
|
|
* sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following
|
|
* conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be
|
|
* included in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef __SAFE_STR_LIB_H__
|
|
#define __SAFE_STR_LIB_H__
|
|
|
|
#include "safe_lib.h"
|
|
|
|
/*
|
|
* The shortest string is a null string!!
|
|
*/
|
|
#define RSIZE_MIN_STR ( 1 )
|
|
|
|
/* maximum sring length */
|
|
#define RSIZE_MAX_STR ( 4UL << 10 ) /* 4KB */
|
|
|
|
|
|
/* The makeup of a password */
|
|
#define SAFE_STR_MIN_LOWERCASE ( 2 )
|
|
#define SAFE_STR_MIN_UPPERCASE ( 2 )
|
|
#define SAFE_STR_MIN_NUMBERS ( 1 )
|
|
#define SAFE_STR_MIN_SPECIALS ( 1 )
|
|
|
|
#define SAFE_STR_PASSWORD_MIN_LENGTH ( 6 )
|
|
#define SAFE_STR_PASSWORD_MAX_LENGTH ( 32 )
|
|
|
|
|
|
/* set string constraint handler */
|
|
extern constraint_handler_t
|
|
set_str_constraint_handler_s(constraint_handler_t handler);
|
|
|
|
|
|
/* string copy */
|
|
extern errno_t
|
|
strcpy_s(char *dest, rsize_t dmax, const char *src);
|
|
|
|
/* string length */
|
|
extern rsize_t
|
|
strnlen_s (const char *s, rsize_t smax);
|
|
|
|
|
|
#endif /* __SAFE_STR_LIB_H__ */
|