Skip to content
Snippets Groups Projects
Select Git revision
  • b33eea3b4a3eb5ea07c9615f195f84d43cda5178
  • master default
  • jas-ci-test
  • wip-slh-dsa-sha2-128s
  • master-updates
  • release-3.10-fixes
  • getopt-prototype
  • fix-bcrypt-warning
  • refactor-hmac
  • wip-use-alignas
  • trim-sha3-context
  • fix-gitlab-ci
  • check-fat-emulate
  • delete-digest_func-size
  • slh-dsa-shake-128f-nettle
  • slh-dsa-shake-128s-nettle
  • slh-dsa-shake-128s
  • delete-openpgp
  • ppc64-sha512
  • delete-md5-compat
  • cleanup-hmac-tests
  • nettle_3.10.2_release_20250626
  • nettle_3.10.1_release_20241230
  • nettle_3.10_release_20240616
  • nettle_3.10rc2
  • nettle_3.10rc1
  • nettle_3.9.1_release_20230601
  • nettle_3.9_release_20230514
  • nettle_3.8.1_release_20220727
  • nettle_3.8_release_20220602
  • nettle_3.7.3_release_20210606
  • nettle_3.7.2_release_20210321
  • nettle_3.7.1_release_20210217
  • nettle_3.7_release_20210104
  • nettle_3.7rc1
  • nettle_3.6_release_20200429
  • nettle_3.6rc3
  • nettle_3.6rc2
  • nettle_3.6rc1
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
41 results

curve448-mul.c

  • admin.c 3.96 KiB
    /*
     * $Id: admin.c,v 0.8 1993/10/10 16:45:24 ceder Exp $
     * Copyright (C) 1991  Lysator Academic Computer Association.
     *
     * This file is part of the LysKOM server.
     * 
     * LysKOM is free software; you can redistribute it and/or modify it
     * under the terms of the GNU General Public License as published by 
     * the Free Software Foundation; either version 1, or (at your option) 
     * any later version.
     * 
     * LysKOM is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     * for more details.
     * 
     * You should have received a copy of the GNU General Public License
     * along with LysKOM; see the file COPYING.  If not, write to
     * Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
     * or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
     * MA 02139, USA.
     *
     * Please mail bug reports to bug-lyskom@lysator.liu.se. 
     */
    /*
     * admin.c
     *
     * Administrative calls.
     */
    
    static char *rcsid = "$Id: admin.c,v 0.8 1993/10/10 16:45:24 ceder Exp $";
    #include "rcs.h"
    USE(rcsid);
    
    #include <stdio.h>
    #include <setjmp.h>
    
    #include "misc-types.h"
    #include "kom-types.h"
    #include "manipulate.h"
    #include "com.h"
    #include "connections.h"
    #include "kom-errno.h"
    #include "cache.h"
    #include "config.h"
    #include "log.h"
    #include "send-async.h"
    
    Info kom_info = 
    {
    #include "version.incl"
        ,				/* version */
        1,				/* conf_pres_conf */
        2,				/* pers_pres_conf */
        3,				/* motd_conf */
        4,				/* kom_news_conf */
        0				/* motd_of_lyskom */
    };
    
    /*
     * Return info about this server. This can (and should) be done
     * before logging in. modt_of_lyskom should be displayed before
     * prompting for username if it isn't 0.
     */
    extern Success
    get_info( Info *result )
    {
        *result = kom_info;
        return OK;
    }
    
    /* /// */
    extern Success
    set_motd_of_lyskom (Text_no motd)
    {
        Text_stat *old_motd = NULL;
        Text_stat *new_motd = NULL;
    
        CHK_LOGIN(FAILURE);
    
        if ( !ENA(admin, 1) )
        {
    	kom_errno = KOM_PERM;
    	return FAILURE;
        }
        
        /* Check that the new motd exists before deleting the old*/
    
        if ( motd != 0 )
        {
    	GET_T_STAT(new_motd, motd, FAILURE);
    	if ( new_motd->no_of_marks >= MAX_MARKS_TEXT )
    	{
    	    log("LIMIT: set_motd_of_lyskom(%d): New motd has %d marks.\n",
    		motd, new_motd->no_of_marks);
    	    kom_errno = KOM_MARK_LIMIT;
    	    return FAILURE;
    	}
        }
        
        /* Unmark the previous motd if it exists. */
    
        if ( kom_info.motd_of_lyskom != 0
    	&& (old_motd = cached_get_text_stat(kom_info.motd_of_lyskom)) != NULL)
        {
    	if ( old_motd->no_of_marks > 0 )
    	{
    	    --old_motd->no_of_marks;
    	    mark_text_as_changed( kom_info.motd_of_lyskom );
    	}
    	else
    	{
    	    log("ERROR: do_set_motd(): Old motd not marked\n");
    	}
        }
    
        /* Mark the new motd */
    
        if ( motd != 0 )
        {
    	++new_motd->no_of_marks;
    	mark_text_as_changed( motd );
        }
        
        kom_info.motd_of_lyskom = motd;
    
        return OK;
    }
    
    
    
    
    /*
     * Force all clients to read a message.
     * Sends an asynchronous message. This is obsoleted by send_message.
     */
    extern Success
    broadcast (String message)
    {
        CHK_LOGIN(FAILURE);
    
        if (s_strlen(message) > BROADCAST_LEN)
        {
    	kom_errno = KOM_LONG_STR;
    	return FAILURE;
        }
    
        async_broadcast(ACTPERS, message);
        return OK;
    }
    
    /*
     * Send a message
     */
    extern Success
    send_message (Pers_no recipient,
    	      const String message)
    {
        CHK_LOGIN(FAILURE);
    
        if (s_strlen(message) > BROADCAST_LEN)
        {
    	kom_errno = KOM_LONG_STR;
    	return FAILURE;
        }
    
        return async_send_message(recipient, ACTPERS, message);
    }
    
    
    
    /*
     * Make LysKOM sync its files.
     */
    extern Success
    sync (void) 
    {
        cache_sync_all();
        dump_statistics();
        return OK;
    }
    
    /*
     * Close LysKOM. exit_val is (currently) not used. The database is synced.
     */
    extern Success
    shutdown_kom (int exit_val) 
    {
        CHK_LOGIN(FAILURE);
        if ( !ENA(admin, 1) )
        {
    	kom_errno = KOM_PERM;
    	return FAILURE;
        }
    
        go_and_die = TRUE;
        return OK;
    }