!C99Shell v. 1.0 pre-release build #13!

Software: Apache/2.0.54 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.54 OpenSSL/0.9.7l DAV/2 FrontPage/5.0.2.2635 PHP/4.4.0 mod_gzip/2.0.26.1a 

uname -a: Linux snow.he.net 4.4.276-v2-mono-1 #1 SMP Wed Jul 21 11:21:17 PDT 2021 i686 

uid=99(nobody) gid=98(nobody) groups=98(nobody) 

Safe-mode: OFF (not secure)

/usr/src/linux-2.4.18-xfs-1.1/drivers/isdn/eicon/   drwxr-xr-x
Free 318.31 GB of 458.09 GB (69.49%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     linchr.c (3.94 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*
 * Copyright (C) Eicon Technology Corporation, 2000.
 *
 * Eicon File Revision :    1.12  
 *
 * This software may be used and distributed according to the terms
 * of the GNU General Public License, incorporated herein by reference.
 *
 */

#define __NO_VERSION__
#include <linux/module.h>

#include <linux/kernel.h>
#include <linux/poll.h>
#include <linux/fs.h>
#include <linux/slab.h>

#undef N_DATA

#include "adapter.h"
#include "divas.h"
#include "divalog.h"

extern int DivasCardNext;
void UxPause(long ms);
int DivasGetMem(mem_block_t *);

#define DIA_IOCTL_UNLOCK 12
void UnlockDivas(void);

int do_ioctl(struct inode *pDivasInode, struct file *pDivasFile, 
             unsigned int command, unsigned long arg)
{
    byte *pUserCards, card_i;
    word wCardNum;

    switch (command)
    {
        case DIA_IOCTL_CONFIG:
        {
            dia_config_t DivaConfig;
            if (copy_from_user(&DivaConfig, (void *)arg, sizeof(dia_config_t)))
                return -EFAULT;
            DivasCardConfig(&DivaConfig);
            return 0;
        }

        case DIA_IOCTL_DETECT:
            pUserCards = (byte *) arg;

            if (!verify_area(VERIFY_WRITE, pUserCards, 20))
            {
                if(__put_user(DivasCardNext, pUserCards++))
                    return -EFAULT;

                for (card_i=1; card_i < 20; card_i++)
                {
                    if(__put_user((byte) DivasCards[card_i - 1].cfg.card_type, pUserCards++))
                        return -EFAULT;
                }
            }
            else return -EFAULT;

            return 0;

        case DIA_IOCTL_START:
        {
            dia_start_t DivaStart;
            if (copy_from_user(&DivaStart, (void *)arg, sizeof(dia_start_t)))
                return -EFAULT;
            return DivasCardStart(DivaStart.card_id);
        }

        case DIA_IOCTL_FLAVOUR:
            return 0;

        case DIA_IOCTL_LOAD:
        {
            dia_load_t DivaLoad;
            if(copy_from_user(&DivaLoad, (void *)arg, sizeof(dia_load_t)))
                return -EFAULT;
            if (!verify_area(VERIFY_READ, DivaLoad.code,DivaLoad.length))
            {
                if (DivasCardLoad(&DivaLoad))
                {
                    printk(KERN_WARNING "Divas: Error loading DIVA Server adapter\n");
                    return -EINVAL;
                }
                return 0;
            }
            return -EFAULT;
        }
        case DIA_IOCTL_LOG:
        {
            dia_log_t DivaLog;
            if (copy_from_user(&DivaLog, (void *) arg, sizeof(dia_log_t)))
                return -EFAULT;
            DivasLog(&DivaLog);
            return 0;
        }

        case DIA_IOCTL_XLOG_REQ:
            if(get_user(wCardNum, (word *) arg))
                return -EFAULT;
            DivasXlogReq(wCardNum);
            return 0;

        case DIA_IOCTL_GET_NUM:
            if(put_user(DivasCardNext, (int *)arg))
                return -EFAULT;
            return 0;

        case DIA_IOCTL_GET_LIST:
        {
            dia_card_list_t cards;
            DPRINTF(("divas: DIA_IOCTL_GET_LIST"));
            DivasGetList(&cards);
            if(copy_to_user((void *)arg, &cards, sizeof(cards)))
                return -EFAULT;
            return 0;
        }
        case DIA_IOCTL_GET_MEM:
        {
            mem_block_t mem_block;
            if (copy_from_user(&mem_block, (void *)arg, sizeof(mem_block_t)))
                return -EFAULT;
            DivasGetMem(&mem_block);
            return 0;
        }

        case DIA_IOCTL_UNLOCK:
            UnlockDivas();
            return 0;

        default:
            return -EINVAL;
    }
    return -EINVAL;
}

unsigned int do_poll(struct file *pFile, struct poll_table_struct *pPollTable)
{
    word wMask = 0;

    if (!DivasLogFifoEmpty())
        wMask |= POLLIN | POLLRDNORM;
    return wMask;
}

ssize_t do_read(struct file *pFile, char *pUserBuffer, size_t BufferSize, loff_t *pOffset)
{
    klog_t *pClientLogBuffer = (klog_t *) pUserBuffer;
    klog_t *pHeadItem;

    if (BufferSize < sizeof(klog_t))
    {
        printk(KERN_WARNING "Divas: Divalog buffer specifed a size that is too small (%d - %d required)\n",
            BufferSize, sizeof(klog_t));
        return -EIO;
    }

    pHeadItem = (klog_t *) DivasLogFifoRead();

    if (pHeadItem)
    {
        memcpy(pClientLogBuffer, pHeadItem, sizeof(klog_t));
        kfree(pHeadItem);
        return sizeof(klog_t);
    }

    return 0;
}
static int private_usage_count;

int do_open(struct inode *pInode, struct file *pFile)
{
    MOD_INC_USE_COUNT;
#ifdef MODULE
    private_usage_count++;
#endif
    return 0;
}

int do_release(struct inode *pInode, struct file *pFile)
{
    MOD_DEC_USE_COUNT;
#ifdef MODULE
    private_usage_count--;
#endif
    return 0;
}

void UnlockDivas(void)
{
    while (private_usage_count > 0)
    {
        private_usage_count--;
        MOD_DEC_USE_COUNT;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0044 ]--