2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include <sys/types.h>
23 #include <security-server.h>
25 #include "phone-lock-util.h"
26 #include "phone-lock-verification.h"
27 #include "phone-lock-string.h"
34 int phone_lock_verification_check_length(const char *str, int min, int max)
39 return IDS_IDLE_BODY_PASSWORD_EMPTY;
44 PHONE_LOCK_DBG("%s() len : %d", __FUNCTION__, len);
47 return IDS_IDLE_BODY_PASSWORD_EMPTY;
50 if (len < min || len > max) {
51 return IDS_IDLE_BODY_PD_TO_PD_DIGITS_OR_LETTERS_REQUIRED;
57 int phone_lock_verification_check_phone_password(const char *str)
59 PHONE_LOCK_DBG("%s : %s\n", __FUNCTION__, str);
61 int ret = SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH;
63 unsigned int current_attempt = 0;
64 unsigned int max_attempt = 0;
65 unsigned int valid_secs = 0;
67 ret = security_server_chk_pwd(str, ¤t_attempt, &max_attempt, &valid_secs);
68 if (SECURITY_SERVER_API_SUCCESS == ret) {
69 PHONE_LOCK_DBG("correct password!");