Changeset 5d96851 in mainline for uspace/srv/loader/main.c


Ignore:
Timestamp:
2009-07-06T19:17:49Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0315679
Parents:
7114d83
Message:

Pass task ID to NS from loader. This prevents ID spoofing by user apps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/loader/main.c

    r7114d83 r5d96851  
    5353#include <ipc/services.h>
    5454#include <ipc/loader.h>
     55#include <ipc/ns.h>
     56#include <macros.h>
    5557#include <loader/pcb.h>
    5658#include <errno.h>
     
    438440{
    439441        ipcarg_t phonead;
    440        
     442        task_id_t id;
     443        int rc;
     444
    441445        connected = false;
    442        
     446
     447        /* Introduce this task to the NS (give it our task ID). */
     448        id = task_get_id();
     449        rc = async_req_2_0(PHONE_NS, NS_ID_INTRO, LOWER32(id), UPPER32(id));
     450        if (rc != EOK)
     451                return -1;
     452
    443453        /* Set a handler of incomming connections. */
    444454        async_set_client_connection(ldr_connection);
     
    446456        /* Register at naming service. */
    447457        if (ipc_connect_to_me(PHONE_NS, SERVICE_LOAD, 0, 0, &phonead) != 0)
    448                 return -1;
    449        
     458                return -2;
     459
    450460        async_manager();
    451461       
Note: See TracChangeset for help on using the changeset viewer.