git.ucc.asn.au
/
tpg
/
opendispense2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Client - Broke the client out into separate files
[tpg/opendispense2.git]
/
src
/
server
/
server.c
diff --git
a/src/server/server.c
b/src/server/server.c
index
e392f73
..
9780058
100644
(file)
--- a/
src/server/server.c
+++ b/
src/server/server.c
@@
-25,6
+25,8
@@
#define DEBUG_TRACE_CLIENT 0
#define HACK_NO_REFUNDS 1
#define DEBUG_TRACE_CLIENT 0
#define HACK_NO_REFUNDS 1
+#define PIDFILE "/var/run/dispsrv.pid"
+
// Statistics
#define MAX_CONNECTION_QUEUE 5
#define INPUT_BUFFER_SIZE 256
// Statistics
#define MAX_CONNECTION_QUEUE 5
#define INPUT_BUFFER_SIZE 256
@@
-215,7
+217,7
@@
void Server_Start(void)
// write pidfile
{
// write pidfile
{
- FILE *fp = fopen(
"/var/run/dispsrv.pid"
, "w");
+ FILE *fp = fopen(
PIDFILE
, "w");
if( fp ) {
fprintf(fp, "%i", getpid());
fclose(fp);
if( fp ) {
fprintf(fp, "%i", getpid());
fclose(fp);
@@
-307,7
+309,7
@@
void Server_Cleanup(void)
{
printf("\nClose(%i)\n", giServer_Socket);
close(giServer_Socket);
{
printf("\nClose(%i)\n", giServer_Socket);
close(giServer_Socket);
- unlink(
"/var/run/dispsrv.pid"
);
+ unlink(
PIDFILE
);
}
/**
}
/**
@@
-683,8
+685,7
@@
void Server_Cmd_SETEUSER(tClient *Client, char *Args)
sendf(Client->Socket, "404 User not found\n");
return ;
}
sendf(Client->Socket, "404 User not found\n");
return ;
}
-
- // You can't be an internal account
+ // You can't be an internal account (unless you're an admin)
if( !(userFlags & USER_FLAG_ADMIN) )
{
eUserFlags = Bank_GetFlags(Client->EffectiveUID);
if( !(userFlags & USER_FLAG_ADMIN) )
{
eUserFlags = Bank_GetFlags(Client->EffectiveUID);
@@
-703,7
+704,7
@@
void Server_Cmd_SETEUSER(tClient *Client, char *Args)
// Disabled accounts
if( userFlags & USER_FLAG_DISABLED ) {
// Disabled accounts
if( userFlags & USER_FLAG_DISABLED ) {
- Client->UID = -1;
+ Client->
Effective
UID = -1;
sendf(Client->Socket, "403 Account disabled\n");
return ;
}
sendf(Client->Socket, "403 Account disabled\n");
return ;
}
@@
-731,7
+732,7
@@
void Server_int_SendItem(tClient *Client, tItem *Item)
}
}
}
}
- if( Item->Price == 0 )
+ if(
!gbNoCostMode &&
Item->Price == 0 )
status = "error";
// KNOWN HACK: Naming a slot 'dead' disables it
if( strcmp(Item->Name, "dead") == 0 )
status = "error";
// KNOWN HACK: Naming a slot 'dead' disables it
if( strcmp(Item->Name, "dead") == 0 )
UCC
git Repository :: git.ucc.asn.au