<commit_before>#include <stdio.h>
#include <stdlib.h>
#include "graph_auth.h"
/**
 * * SECTION: graph-auth
 * * @short_description: A graph login authenticator
 * *
 * * The #GraphAuthPam is a class to authenticate a graph login.
 * */
G_DEFINE_TYPE_WITH_PRIVATE (GraphAuthPam, graph_auth_pam, G_TYPE_OBJECT)

gboolean graph_auth_pam_authenticate(GraphAuthPam* self, gchar* auth_token, gint* err);



#include <security/pam_appl.h>
int
pam_token_pass (int num_msg, const struct pam_message **msg,
                    struct pam_response **resp, void *appdata_ptr){

    for(num_msg--;num_msg >= 0;num_msg--){
        struct pam_response* r;
        r = resp[num_msg];
        if(r != NULL){
            r->resp = appdata_ptr;
        }
    }

    return PAM_SUCCESS;
}

static void
graph_auth_pam_class_init(GraphAuthPamClass* gap_class){

#ifdef DBUS_SERVICE
    //Install interscoption data
    dbus_g_object_type_install_info(graph_auth_pam_TYPE,
                                    &dbus_glib_graph_auth_pam_object_info);
#endif

}

static void
graph_auth_pam_init(GraphAuthPam* self){
    int error = 0;
    GraphAuthPamPrivate* gapp = G_TYPE_INSTANCE_GET_PRIVATE(self, GRAPH_AUTH_PAM_TYPE, GraphAuthPamPrivate);
    struct pam_conv* pam_c = g_malloc(sizeof(struct pam_conv));
    
    pam_c->conv = &pam_token_pass;
    pam_c->appdata_ptr = "aaaaaaaa";

    error = pam_start("graph", "reyad", pam_c, &(gapp->pam_handle));
    if(error != PAM_SUCCESS){
        g_printerr("Error starting pam transaction\n");
    }
}

/**
* graph_auth_pam_new:
* *
* * Allocates a new #GraphAuthPam.
* *
* * Return value: a new #GraphAuthPam.
* */
GraphAuthPam*
graph_auth_pam_new(){
    GraphAuthPam* Auth;

    Auth = g_object_new(GRAPH_AUTH_PAM_TYPE, NULL);
<commit_msg>Added support for multiple users not just me. This was done with cuserid()<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include "graph_auth.h"
/**
 * * SECTION: graph-auth
 * * @short_description: A graph login authenticator
 * *
 * * The #GraphAuthPam is a class to authenticate a graph login.
 * */
G_DEFINE_TYPE_WITH_PRIVATE (GraphAuthPam, graph_auth_pam, G_TYPE_OBJECT)

gboolean graph_auth_pam_authenticate(GraphAuthPam* self, gchar* auth_token, gint* err);



#include <security/pam_appl.h>

const char* PAM_SERVICE_NAME = "graph";

int
pam_token_pass (int num_msg, const struct pam_message **msg,
                    struct pam_response **resp, void *appdata_ptr){

    for(num_msg--;num_msg >= 0;num_msg--){
        struct pam_response* r;
        r = resp[num_msg];
        if(r != NULL){
            r->resp = appdata_ptr;
        }
    }

    return PAM_SUCCESS;
}

static void
graph_auth_pam_class_init(GraphAuthPamClass* gap_class){

#ifdef DBUS_SERVICE
    //Install interscoption data
    dbus_g_object_type_install_info(graph_auth_pam_TYPE,
                                    &dbus_glib_graph_auth_pam_object_info);
#endif

}

static void
graph_auth_pam_init(GraphAuthPam* self){
    int error = 0;

    uid_t uid = getuid();
    char username[0xFF];

    GraphAuthPamPrivate* gapp = G_TYPE_INSTANCE_GET_PRIVATE(self, GRAPH_AUTH_PAM_TYPE, GraphAuthPamPrivate);
    struct pam_conv* pam_c = g_malloc(sizeof(struct pam_conv));
   
    cuserid(username);

    pam_c->conv = &pam_token_pass;
    pam_c->appdata_ptr = "aaaaaaaa";

    g_print("UID: %d\n", uid);

    error = pam_start(PAM_SERVICE_NAME, username, pam_c, &(gapp->pam_handle));
    if(error != PAM_SUCCESS){
        g_printerr("Error starting pam transaction\n");
    }
}

/**
* graph_auth_pam_new:
* *
* * Allocates a new #GraphAuthPam.
* *
* * Return value: a new #GraphAuthPam.
* */
GraphAuthPam*
graph_auth_pam_new(){
    GraphAuthPam* Auth;

    Auth = g_object_new(GRAPH_AUTH_PAM_TYPE, NULL);

{'fraction_non_alphanumeric': 0.1128518321826872, 'fraction_numerical': 0.0013276686139139671, 'mean_word_length': 3.6334563345633457, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7174520', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1387, 'n_words': 273}