Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Main
Synchronet
Commits
049732f2
Commit
049732f2
authored
5 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Add a user/password store.
parent
8d921b99
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
xtrn/lord/addpass.js
+12
-0
12 additions, 0 deletions
xtrn/lord/addpass.js
xtrn/lord/lordsrv.js
+35
-12
35 additions, 12 deletions
xtrn/lord/lordsrv.js
with
47 additions
and
12 deletions
xtrn/lord/addpass.js
0 → 100644
+
12
−
0
View file @
049732f2
if
(
argc
!==
2
)
{
print
(
'
Usage: addpass user pass
'
);
exit
(
1
);
}
var
f
=
new
File
(
js
.
exec_dir
+
'
bbs.cred
'
);
if
(
!
f
.
open
(
'
a
'
))
{
throw
(
'
Unable to open
'
+
f
.
name
);
}
var
sha
=
new
CryptContext
(
CryptContext
.
ALGO
.
SHA2
);
sha
.
blocksize
=
64
;
sha
.
encrypt
(
argv
[
0
]
+
argv
[
1
]);
f
.
writeln
(
argv
[
0
]
+
'
:
'
+
base64_encode
(
sha
.
hashvalue
));
This diff is collapsed.
Click to expand it.
xtrn/lord/lordsrv.js
+
35
−
12
View file @
049732f2
...
...
@@ -19,26 +19,39 @@ var settingsmap = {
retry_delay
:
'
RetryDelay
'
,
file_prefix
:
'
GamePrefix
'
};
var
pfile
=
new
RecordFile
(
settings
.
file_prefix
+
'
player.bin
'
,
SPlayer_Def
);
;
var
sfile
=
new
RecordFile
(
settings
.
file_prefix
+
'
state.bin
'
,
Server_State_Def
)
;
var
lfile
=
new
File
(
settings
.
file_prefix
+
'
logall.lrd
'
)
;
var
pfile
;
var
sfile
;
var
lfile
;
var
socks
;
var
pdata
=
[];
var
sdata
;
var
whitelist
=
[
'
Record
'
,
'
Yours
'
];
var
swhitelist
=
[];
var
logdata
=
[];
var
conversations
=
{
bar
:{
file
:
new
File
(
settings
.
file_prefix
+
'
bar.lrd
'
),
lines
:[],
default_files
:[
js
.
exec_dir
+
'
start1.lrd
'
,
js
.
exec_dir
+
'
start2.lrd
'
,
js
.
exec_dir
+
'
start3.lrd
'
,
js
.
exec_dir
+
'
start4.lrd
'
,
js
.
exec_dir
+
'
start5.lrd
'
]},
darkbar
:{
file
:
new
File
(
settings
.
file_prefix
+
'
darkbar.lrd
'
),
lines
:[],
default_files
:[
js
.
exec_dir
+
'
dstart.lrd
'
]},
garden
:{
file
:
new
File
(
settings
.
file_prefix
+
'
garden.lrd
'
),
lines
:[],
default_files
:[
js
.
exec_dir
+
'
gstart.lrd
'
]},
dirt
:{
file
:
new
File
(
settings
.
file_prefix
+
'
dirt.lrd
'
),
lines
:[]}
};
var
conversations
;
// TODO: This is obviously silly.
function
validate_user
(
user
,
pass
)
function
validate_user
(
sock
,
usr
,
pass
)
{
return
true
;
var
f
=
new
File
(
settings
.
file_prefix
+
'
bbs.cred
'
);
var
l
;
var
m
;
var
sha
=
new
CryptContext
(
CryptContext
.
ALGO
.
SHA2
);
sha
.
blocksize
=
64
;
sha
.
encrypt
(
usr
+
pass
);
sha
=
base64_encode
(
sha
.
hashvalue
);
if
(
!
f
.
open
(
'
r
'
))
{
throw
(
'
Unable to open
'
+
f
.
name
);
}
while
((
l
=
f
.
readln
())
!==
null
)
{
m
=
l
.
match
(
/^
(
.*
)
:
(
.*
?)
$/
);
if
(
m
!==
null
)
{
if
(
m
[
1
]
===
usr
&&
m
[
2
]
===
sha
)
return
true
;
}
}
return
false
;
}
// TODO: Blocking Locks (?)
...
...
@@ -1103,7 +1116,17 @@ function parse_settings()
settings
[
key
]
=
ini
.
iniGetValue
(
null
,
settingsmap
[
key
],
settings
[
key
]);
});
fixup_prefix
();
f
.
close
();
}
conversations
=
{
bar
:{
file
:
new
File
(
settings
.
file_prefix
+
'
bar.lrd
'
),
lines
:[],
default_files
:[
js
.
exec_dir
+
'
start1.lrd
'
,
js
.
exec_dir
+
'
start2.lrd
'
,
js
.
exec_dir
+
'
start3.lrd
'
,
js
.
exec_dir
+
'
start4.lrd
'
,
js
.
exec_dir
+
'
start5.lrd
'
]},
darkbar
:{
file
:
new
File
(
settings
.
file_prefix
+
'
darkbar.lrd
'
),
lines
:[],
default_files
:[
js
.
exec_dir
+
'
dstart.lrd
'
]},
garden
:{
file
:
new
File
(
settings
.
file_prefix
+
'
garden.lrd
'
),
lines
:[],
default_files
:[
js
.
exec_dir
+
'
gstart.lrd
'
]},
dirt
:{
file
:
new
File
(
settings
.
file_prefix
+
'
dirt.lrd
'
),
lines
:[]}
};
pfile
=
new
RecordFile
(
settings
.
file_prefix
+
'
player.bin
'
,
SPlayer_Def
);
sfile
=
new
RecordFile
(
settings
.
file_prefix
+
'
state.bin
'
,
Server_State_Def
)
lfile
=
new
File
(
settings
.
file_prefix
+
'
logall.lrd
'
);
return
true
;
}
...
...
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