| die letzten Änderungen * Seitenstruktur * Stichwortsuche :


logo_puschin.jpg

Startseite

Knowledge base



Kontakt

Impressum

Knowledge base - C

Knowledge base

5 Benutzer online Druckversion




zurück



C
Modifikation mjpg_streamer hinsichtlich Logging von Login-Fehlern


#include "../output_file/output_file.h"

static char ipadresse[32];
static globals *pglobal;

...

/* check for username and password if parameter -c was given */
    if(lcfd.pc->conf.credentials != NULL) {
        if(req.credentials == NULL || strcmp(lcfd.pc->conf.credentials, req.credentials) != 0) {
            DBG("access denied\n");
            send_error(lcfd.fd, 401, "username and password do not match to configuration");
            close(lcfd.fd);

            //
            // Logging, falls erwuenscht
            //
            if (req.credentials != NULL)
            {
                if (strlen(req.credentials)+strlen(req.client)+strlen(ipadresse) < 200)
                {
                    FILE * file;
                    if (file = fopen("wrong_credentials.sh", "r"))
                    {
                        char syscommand[255];
                        sprintf(syscommand, "./wrong_credentials.sh '%s' '%s' '%s'", req.credentials, ipadresse, req.client);
                        system(syscommand);
                        fclose(file);
                    }
                }
            }

            free_request(&req);
            return NULL;
        }
        DBG("access granted\n");
    }

...

if(getnameinfo((struct sockaddr *)&client_addr, addr_len, name, sizeof(name), NULL, 0, NI_NUMERICHOST) == 0) {
//                    syslog(LOG_INFO, "serving client: %s\n", name);
                    sprintf(ipadresse, "%s", name);
                    DBG("serving client: %s\n", name);
                }




zurück



Knowledge base wurde zuletzt bearbeitet am 12.07.13 durch Frank

www.puschin.de
login

<body bgcolor='#FFFFFF' link='#000000' vlink='#000000' alink='#000000' text='#000000'><font face='Verdana' size='2'><strong>www.puschin.de</strong><br>Die Webseite http://www.puschin.de bietet eine interessante Webseite zu vielen Themen aus dem Bereich Linux und Windows. Man findet hier Tipps und Tricks zu cms php apache postfix openxchange tomcat windows linux firewall <br><br><font face='Verdana' size='2'><li><a href='cms.php?print=&aktion=thema_anzeigen&menue_id=191'>Startseite</a><font face='Verdana' size='2'><li><a href='cms.php?print=&aktion=thema_anzeigen&menue_id=63'>Knowledge base</a><font face='Verdana' size='2'><li><a href='cms.php?print=&aktion=thema_anzeigen&menue_id=57'>Kontakt</a><font face='Verdana' size='2'><li><a href='cms.php?print=&aktion=thema_anzeigen&menue_id=9'>Impressum</a></body>