~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kdm/backend/rpcauth.c

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
Copyright 1988, 1998  The Open Group
 
4
 
 
5
Permission to use, copy, modify, distribute, and sell this software and its
 
6
documentation for any purpose is hereby granted without fee, provided that
 
7
the above copyright notice appear in all copies and that both that
 
8
copyright notice and this permission notice appear in supporting
 
9
documentation.
 
10
 
 
11
The above copyright notice and this permission notice shall be included
 
12
in all copies or substantial portions of the Software.
 
13
 
 
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
15
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
16
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 
17
IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 
18
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 
19
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 
20
OTHER DEALINGS IN THE SOFTWARE.
 
21
 
 
22
Except as contained in this notice, the name of a copyright holder shall
 
23
not be used in advertising or otherwise to promote the sale, use or
 
24
other dealings in this Software without prior written authorization
 
25
from the copyright holder.
 
26
 
 
27
*/
 
28
 
 
29
/*
 
30
 * xdm - display manager daemon
 
31
 * Author: Keith Packard, MIT X Consortium
 
32
 *
 
33
 * generate SecureRPC authorization records
 
34
 */
 
35
 
 
36
#include "dm.h"
 
37
#include "dm_auth.h"
 
38
#include "dm_error.h"
 
39
 
 
40
#include <rpc/rpc.h>
 
41
#include <rpc/key_prot.h>
 
42
 
 
43
Xauth *
 
44
secureRPCGetAuth(unsigned short namelen, const char *name)
 
45
{
 
46
    Xauth *new;
 
47
    char key[MAXNETNAMELEN+1];
 
48
 
 
49
    if (!(new = getAuthHelper(namelen, name)))
 
50
        return 0;
 
51
 
 
52
    getnetname(key);
 
53
    debug("system netname %s\n", key);
 
54
    new->data_length = strlen(key);
 
55
    if (!(new->data = Malloc(new->data_length))) {
 
56
        free(new->name);
 
57
        free(new);
 
58
        return 0;
 
59
    }
 
60
    memmove(new->data, key, new->data_length);
 
61
    return new;
 
62
}