Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-server-http-db-auth
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
libdap-server-http-db-auth
Commits
4c295056
Commit
4c295056
authored
5 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[*] Refactored some
parent
9a52204d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+7
-5
7 additions, 5 deletions
CMakeLists.txt
include/db_auth.h
+16
-20
16 additions, 20 deletions
include/db_auth.h
src/db_auth.c
+2
-2
2 additions, 2 deletions
src/db_auth.c
with
25 additions
and
27 deletions
CMakeLists.txt
+
7
−
5
View file @
4c295056
cmake_minimum_required
(
VERSION 3.0
)
cmake_minimum_required
(
VERSION 3.0
)
project
(
dap_server_http_db_auth
)
project
(
dap_server_http_db_auth
)
set
(
AUTH_SRCS db_auth.c
)
file
(
GLOB DAP_SERVER_HTTP_DB_AUTH_SOURCES src/*.c
)
file
(
GLOB DAP_SERVER_HTTP_DB_AUTH_HEADERS include/*.h
)
add_library
(
${
PROJECT_NAME
}
STATIC
${
AUTH_SRC
S
}
)
add_library
(
${
PROJECT_NAME
}
STATIC
${
DAP_SERVER_HTTP_DB_AUTH_SOURCES
}
${
DAP_SERVER_HTTP_DB_AUTH_HEADER
S
}
)
target_link_libraries
(
${
PROJECT_NAME
}
dap_core
target_link_libraries
(
${
PROJECT_NAME
}
dap_crypto dap_stream dap_server_http_db
)
dap_crypto dap_http_server dap_enc_server
dap_stream dap_http_server_db
)
target_include_directories
(
${
PROJECT_NAME
}
PUBLIC include
)
target_include_directories
(
${
PROJECT_NAME
}
PRIVATE src
)
This diff is collapsed.
Click to expand it.
include/db_auth.h
+
16
−
20
View file @
4c295056
/*
/*
Copyright (c) 2017-201
8
(c) Project "DeM Labs Inc" https://github.com/demlabsinc
Copyright (c) 2017-201
9
(c) Project "DeM Labs Inc" https://github.com/demlabsinc
All rights reserved.
All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
This file is part of DAP (Deus Applications Prototypes) the open source project
...
@@ -18,9 +18,7 @@
...
@@ -18,9 +18,7 @@
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#pragma once
#ifndef STREAM_AUTH_H
#define STREAM_AUTH_H
#include
<stdint.h>
#include
<stdint.h>
#include
<pthread.h>
#include
<pthread.h>
#include
"uthash.h"
#include
"uthash.h"
...
@@ -46,41 +44,39 @@ typedef struct db_auth_info{
...
@@ -46,41 +44,39 @@ typedef struct db_auth_info{
UT_hash_handle
hh
;
// makes this structure hashable with UTHASH library
UT_hash_handle
hh
;
// makes this structure hashable with UTHASH library
}
db_auth_info_t
;
}
db_auth_info_t
;
extern
int
db_auth_init
(
const
char
*
db_name
);
int
db_auth_init
(
const
char
*
db_name
);
extern
void
db_auth_deinit
(
void
);
void
db_auth_deinit
(
void
);
extern
db_auth_info_t
*
db_auth_info_by_cookie
(
const
char
*
cookie
);
db_auth_info_t
*
db_auth_info_by_cookie
(
const
char
*
cookie
);
extern
db_auth_info_t
*
db_search_cookie_in_db
(
const
char
*
cookie
);
db_auth_info_t
*
db_search_cookie_in_db
(
const
char
*
cookie
);
extern
int
db_auth_login
(
const
char
*
login
,
const
char
*
password
,
int
db_auth_login
(
const
char
*
login
,
const
char
*
password
,
const
char
*
domain
,
db_auth_info_t
**
ai
);
const
char
*
domain
,
db_auth_info_t
**
ai
);
extern
db_auth_info_t
*
db_auth_register
(
const
char
*
user
,
const
char
*
password
,
db_auth_info_t
*
db_auth_register
(
const
char
*
user
,
const
char
*
password
,
const
char
*
domain
,
const
char
*
first_name
,
const
char
*
domain
,
const
char
*
first_name
,
const
char
*
last_name
,
const
char
*
email
,
const
char
*
last_name
,
const
char
*
email
,
const
char
*
device_type
,
const
char
*
app_version
,
const
char
*
device_type
,
const
char
*
app_version
,
const
char
*
hostaddr
,
const
char
*
sys_uuid
);
const
char
*
hostaddr
,
const
char
*
sys_uuid
);
extern
db_auth_info_t
*
db_auth_register_channel
(
const
char
*
name_channel
,
const
char
*
domain
,
db_auth_info_t
*
db_auth_register_channel
(
const
char
*
name_channel
,
const
char
*
domain
,
const
char
*
password
);
const
char
*
password
);
extern
bool
exist_user_in_db
(
const
char
*
user
);
bool
exist_user_in_db
(
const
char
*
user
);
bool
db_auth_user_change_password
(
const
char
*
user
,
const
char
*
password
,
extern
bool
db_auth_user_change_password
(
const
char
*
user
,
const
char
*
password
,
const
char
*
new_password
);
const
char
*
new_password
);
extern
bool
db_auth_change_password
(
const
char
*
user
,
const
char
*
new_password
);
bool
db_auth_change_password
(
const
char
*
user
,
const
char
*
new_password
);
extern
bool
check_user_password
(
const
char
*
user
,
const
char
*
password
);
bool
check_user_password
(
const
char
*
user
,
const
char
*
password
);
extern
void
db_auth_http_proc
(
enc_http_delegate_t
*
dg
,
void
*
arg
);
void
db_auth_http_proc
(
enc_http_delegate_t
*
dg
,
void
*
arg
);
extern
void
db_auth_traffic_track_callback
(
dap_server_t
*
srv
);
void
db_auth_traffic_track_callback
(
dap_server_t
*
srv
);
/// Check user data for correct input.
/// Check user data for correct input.
/// @param before_parsing Line size before parsing.
/// @param before_parsing Line size before parsing.
/// @param after_parsing Line size after parsing.
/// @param after_parsing Line size after parsing.
/// @return Returns true if user data is entered correctly
/// @return Returns true if user data is entered correctly
/// (there are 2 separator spaces), otherwise false.
/// (there are 2 separator spaces), otherwise false.
extern
inline
bool
check_user_data_for_space
(
size_t
before_parsing
,
size_t
after_parsing
);
inline
bool
check_user_data_for_space
(
size_t
before_parsing
,
size_t
after_parsing
);
#endif
This diff is collapsed.
Click to expand it.
db_auth.c
→
src/
db_auth.c
+
2
−
2
View file @
4c295056
...
@@ -36,10 +36,10 @@
...
@@ -36,10 +36,10 @@
#include
"dap_enc_http.h"
#include
"dap_enc_http.h"
#include
"dap_enc_base64.h"
#include
"dap_enc_base64.h"
#include
"dap_server.h"
#include
"dap_server.h"
#include
"
../db/
db_core.h"
#include
"db_core.h"
#include
"db_auth.h"
#include
"db_auth.h"
#include
"http_status_code.h"
#include
"http_status_code.h"
#include
"
mongoc.h
"
#include
<
mongoc.h
>
#define LOG_TAG "db_auth"
#define LOG_TAG "db_auth"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment