Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Validations
f42dfffa
Vérifiée
Valider
f42dfffa
rédigé
Il y a 5 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Adding the __restart command
parent
56ed52ab
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!51
User access control and management
Modifications
4
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
4 fichiers modifiés
inc/lektor/commands.h
+4
-1
4 ajouts, 1 suppression
inc/lektor/commands.h
init.sql
+2
-0
2 ajouts, 0 suppression
init.sql
src/commands.c
+29
-0
29 ajouts, 0 suppression
src/commands.c
src/net/listen.c
+3
-0
3 ajouts, 0 suppression
src/net/listen.c
avec
38 ajouts
et
1 suppression
inc/lektor/commands.h
+
4
−
1
Voir le fichier @
f42dfffa
...
...
@@ -92,3 +92,6 @@ bool command_set_playback_option(struct lkt_state *srv,
/* Authentificate users */
bool
command_password
(
struct
lkt_state
*
srv
,
size_t
c
,
char
*
argv
[
LKT_MESSAGE_ARGS_MAX
]);
bool
command_user_add
(
sqlite3
*
db
,
char
*
argv
[
LKT_MESSAGE_ARGS_MAX
]);
/* Program management control */
bool
command_restart
(
struct
lkt_state
*
srv
,
size_t
c
);
Ce diff est replié.
Cliquez pour l'agrandir.
init.sql
+
2
−
0
Voir le fichier @
f42dfffa
...
...
@@ -88,6 +88,8 @@ CREATE TABLE IF NOT EXISTS users
,
PRIMARY
KEY
(
username
,
password
)
)
WITHOUT
ROWID
;
INSERT
INTO
users
(
username
,
password
)
VALUES
(
'sakura'
,
'hashire'
);
-- Some useful values:
-- last_update is the timestamp of the last time the table of kara has been
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/commands.c
+
29
−
0
Voir le fichier @
f42dfffa
...
...
@@ -13,6 +13,35 @@
#include
<string.h>
#include
<strings.h>
#include
<limits.h>
#include
<unistd.h>
#define SELF_EXECUTABLE_LINUX "/proc/self/exe"
#define SELF_EXECUTABLE_FREEBSD "/proc/curproc/file"
#define SELF_EXECUTABLE_SOLARIS "/proc/self/path/a.out"
inline
bool
command_restart
(
struct
lkt_state
*
srv
,
size_t
c
)
{
char
exe
[
PATH_MAX
];
char
*
const
argv
[]
=
{
exe
,
NULL
};
if
(
!
lkt_client_auth
(
srv
,
c
,
false
))
{
fprintf
(
stderr
,
" ! command_restart: Failed to restart, user not authentificated %lu
\n
"
,
c
);
return
false
;
}
if
(
readlink
(
SELF_EXECUTABLE_LINUX
,
exe
,
PATH_MAX
-
1
)
>
0
)
execv
(
exe
,
argv
);
if
(
readlink
(
SELF_EXECUTABLE_FREEBSD
,
exe
,
PATH_MAX
-
1
)
>
0
)
execv
(
exe
,
argv
);
if
(
readlink
(
SELF_EXECUTABLE_SOLARIS
,
exe
,
PATH_MAX
-
1
)
>
0
)
execv
(
exe
,
argv
);
fprintf
(
stderr
,
" ! command_restart: Failed to exec lektor or OS not supported
\n
"
);
return
false
;
}
bool
command_currentsong
(
struct
lkt_state
*
srv
,
size_t
c
)
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/net/listen.c
+
3
−
0
Voir le fichier @
f42dfffa
...
...
@@ -144,6 +144,9 @@ handle_simple_command(struct lkt_state *srv, size_t c, struct lkt_command cmd)
}
else
if
(
!
strcmp
(
cmd
.
name
,
"password"
))
{
err
=
!
command_password
(
srv
,
c
,
cmd
.
args
);
break
;
}
else
if
(
!
strcmp
(
cmd
.
name
,
"__restart"
))
{
err
=
!
command_restart
(
srv
,
c
);
break
;
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter