Skip to content

Commit

Permalink
Envoi de mails implémenté
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirbu committed Jan 22, 2016
1 parent feeb3fa commit f8cdd23
Show file tree
Hide file tree
Showing 3 changed files with 421 additions and 37 deletions.
37 changes: 9 additions & 28 deletions mainServeur.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

#include "serveur.h"


int main()
int main(void)
{
// totalité de la requête (à parser)
// c'est un char* pour être compatible
Expand Down Expand Up @@ -59,44 +58,26 @@ int main()
printf("[+] Analyse de la requête...\n");
parseType(requete, type_requete);

// printf("[D] type_requete : %s\n", type_requete);
printf("[D] type_requete : %s\n", type_requete);

// choix du comportement en fonction du type de requête
if(strncmp(type_requete, "authentification", strlen(type_requete)) == 0)
{
printf("[+] Demande d'authentification !\n");

if(parseLoginPass(requete, login, password))
{
fprintf(stderr, "[-] Erreur : Extraction des informations d'authentification impossible !\n");

envoi_reponse(AUTH_ERROR);

exit(EXIT_FAILURE);
}

if(checkAuthentification(login, password) == 0)
{
printf("[+] Authentification validée !\n");
printf("[+] Bienvenue %s!\n", login);

envoi_reponse(NO_PB);

authentifie = 1;
}
else
{
printf("[+] Authentification refusée !\n");
printf("[+] Dégage %s!\n", login);
authentifie = authentification(requete, login, password);
}
else if(strncmp(type_requete, "send", strlen(type_requete)) == 0)
{
printf("[+] Demande d'envoi d'un message !\n");

envoi_reponse(AUTH_ERROR);
}
sendMessage(requete);
}
else
{
printf("[+] Erreur : trame non reconnue !\n");
envoi_reponse(SERV_ERROR);
}

}

}
Expand Down
Loading

0 comments on commit f8cdd23

Please sign in to comment.