argv.c (1948B)
1/* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20#include "config.h" 21#include "argv.h" 22#include "rdp.h" 23#include "settings.h" 24 25#include <guacamole/mem.h> 26#include <guacamole/protocol.h> 27#include <guacamole/socket.h> 28#include <guacamole/string.h> 29#include <guacamole/user.h> 30 31#include <pthread.h> 32#include <stdlib.h> 33#include <string.h> 34 35int guac_rdp_argv_callback(guac_user* user, const char* mimetype, 36 const char* name, const char* value, void* data) { 37 38 guac_client* client = user->client; 39 guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; 40 guac_rdp_settings* settings = rdp_client->settings; 41 42 /* Update username */ 43 if (strcmp(name, GUAC_RDP_ARGV_USERNAME) == 0) { 44 guac_mem_free(settings->username); 45 settings->username = guac_strdup(value); 46 } 47 48 /* Update password */ 49 else if (strcmp(name, GUAC_RDP_ARGV_PASSWORD) == 0) { 50 guac_mem_free(settings->password); 51 settings->password = guac_strdup(value); 52 } 53 54 /* Update domain */ 55 else if (strcmp(name, GUAC_RDP_ARGV_DOMAIN) == 0) { 56 guac_mem_free(settings->domain); 57 settings->domain = guac_strdup(value); 58 } 59 60 return 0; 61 62}