text:
#define _GNU_SOURCE

#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <sys/mman.h>
#include <sys/signal.h>
#include <sys/ucontext.h>
#include <asm/ldt.h>
#include <err.h>
#include <setjmp.h>
#include <stddef.h>
#include <stdbool.h>
#include <sys/ptrace.h>
#include <sys/user.h>

/*
 * In principle, this test can run on Linux emulation layers (e.g.
 * Illumos "LX branded zones").  Solaris-based kernels reserve LDT
 * entries 0-5 for their own internal purposes, so start our LDT
 * allocations above that reservation.  (The tests don't pass on LX
 * branded zones, but at least this lets them run.)
 */
#define LDT_OFFSET 6

/* An aligned stack accessible through some of our segments. */
static unsigned char stack16[65536] __attribute__((aligned(4096)));

/*
 * An aligned int3 instruction used as a trampoline.  Some of the tests
 * want to fish out their ss values, so this trampoline copies ss to eax
 * before the int3.
 */
asm (".pushsection .text\n\t"
     ".type int3, @function\n\t"
     ".align 4096\n\t"
     "int3:\n\t"
     "mov %ss,%eax\n\t"
     "int3\n\t"
     ".size int3, . - int3\n\t"
     ".align 4096, 0xcc\n\t"
     ".popsection");
extern char int3[4096];

/*
 * At startup, we prepapre:
 *
 * - ldt_nonexistent_sel: An LDT entry that doesn't exist (all-zero
 *   descriptor or out of bounds).
 * - code16_sel: A 16-bit LDT code segment pointing to int3.
 * - data16_sel: A 16-bit LDT data segment pointing to stack16.
 * - npcode32_sel: A 32-bit not-present LDT code segment pointing to int3.
 * - npdata32_sel: A 32-bit not-present LDT data segment pointing to stack16.
 * - gdt_data16_idx: A 16-bit GDT data segment pointing to stack16.
 * - gdt_npdata32_idx: A 32-bit not-present GDT data segment pointing to
 *   stack16.
 *
 * For no particularly good reason, xyz_sel is a selector value with the
 * RPL and LDT bits filled in, whereas xyz_idx is just an index into the
 * descriptor table.  These variables will be zero if their respective
 * segments could not be allocated.
 */
static unsigned short ldt_nonexistent_sel;
static unsigned short code16_sel, data16_sel, npcode32_sel, npdata32_sel;

static unsigned short gdt_data16_idx, gdt_npdata32_idx;

static unsigned short GDT3(int idx)
{
	return (idx << 3) | 3;
}

static unsigned short LDT3(int idx)
{
	return (idx << 3) | 7;
}

/* Our sigaltstack scratch space. */
static char altstack_data[SIGSTKSZ];

static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *),
		       int flags)
{
	struct sigaction sa;
	memset(&sa, 0, sizeof(sa));
	sa.sa_sigaction = handler;
	sa.sa_flags = SA_SIGINFO | flags;
	sigemptyset(&sa.sa_mask);
	if (sigaction(sig, &sa, 0))
		err(1, "sigaction");
}

static void clearhandler(int sig)
{
	struct sigaction sa;
	memset(&sa, 0, sizeof(sa));
	sa.sa_handler = SIG_DFL;
	sigemptyset(&sa.sa_mask);
	if (sigaction(sig, &sa, 0))
		err(1, "sigaction");
}

static void add_ldt(const struct user_desc *desc, unsigned short *var,
		    const char *name)
{
	if (syscall(SYS_modify_ldt, 1, desc, sizeof(*desc)) == 0) {
		*var = LDT3(desc->entry_number);
	} else {
		printf("[NOTE]\tFailed to create %s segment\n", name);
		*var = 0;
	}
}

static void setup_ldt(void)
{
	if ((unsigned long)stack16 > (1ULL << 32) - sizeof(stack16))
		errx(1, "stack16 is too high\n");
	if ((unsigned long)int3 > (1ULL << 32) - sizeof(int3))
		errx(1, "int3 is too high\n");

	ldt_nonexistent_sel = LDT3(LDT_OFFSET + 2);

	const struct user_desc code16_desc = {
		.entry_number    = LDT_OFFSET + 0,
		.base_addr       = (unsigned long)int3,
		.limit           = 4095,
		.seg_32bit       = 0,
		.contents        = 2, /* Code, not conforming */
		.read_exec_only  = 0,
		.limit_in_pages  = 0,
		.seg_not_present = 0,
		.useable         = 0
	};
	add_ldt(&code16_desc, &code16_sel, "code16");

	const struct user_desc data16_desc = {
		.entry_number    = LDT_OFFSET + 1,
		.base_addr       = (unsigned long)stack16,
		.limit           = 0xffff,
		.seg_32bit       = 0,
		.contents        = 0, /* Data, grow-up */
		.read_exec_only  = 0,
		.limit_in_pages  = 0,
		.seg_not_present = 0,
		.useable         = 0
	};
	add_ldt(&data16_desc, &data16_sel, "data16");

	const struct user_desc npcode32_desc = {
		.entry_number    = LDT_OFFSET + 3,
		.base_addr       = (unsigned long)int3,
		.limit           = 4095,
		.seg_32bit       = 1,
		.contents        = 2, /* Code, not conforming */
		.read_exec_only  = 0,
		.limit_in_pages  = 0,
		.seg_not_present = 1,
		.useable         = 0
	};
	add_ldt(&npcode32_desc, &npcode32_sel, "npcode32");

	const struct user_desc npdata32_desc = {
		.entry_number    = LDT_OFFSET + 4,
		.base_addr       = (unsigned long)stack16,
		.limit           = 0xffff,
		.seg_32bit       = 1,
		.contents        = 0, /* Data, grow-up */
		.read_exec_only  = 0,
		.limit_in_pages  = 0,
		.seg_not_present = 1,
		.useable         = 0
	};
	add_ldt(&npdata32_desc, &npdata32_sel, "npdata32");

	struct user_desc gdt_data16_desc = {
		.entry_number    = -1,
		.base_addr       = (unsigned long)stack16,
		.limit           = 0xffff,
		.seg_32bit       = 0,
		.contents        = 0, /* Data, grow-up */
		.read_exec_only  = 0,
		.limit_in_pages  = 0,
		.seg_not_present = 0,
		.useable         = 0
	};

	if (syscall(SYS_set_thread_area, &gdt_data16_desc) == 0) {
		/*
		 * This probably indicates vulnerability to CVE-2014-8133.
		 * Merely getting here isn't definitive, though, and we'll
		 * diagnose the problem for real later on.
		 */
		printf("[WARN]\tset_thread_area allocated data16 at index %d\n",
		       gdt_data16_desc.entry_number);
		gdt_data16_idx = gdt_data16_desc.entry_number;
	} else {
		printf("[OK]\tset_thread_area refused 16-bit data\n");
	}

	struct user_desc gdt_npdata32_desc = {
		.entry_number    = -1,
		.base_addr       = (unsigned long)stack16,
		.limit           = 0xffff,
		.seg_32bit       = 1,
		.contents        = 0, /* Data, grow-up */
		.read_exec_only  = 0,
		.limit_in_pages  = 0,
		.seg_not_present = 1,
		.useable         = 0
	};

	if (syscall(SYS_set_thread_area, &gdt_npdata32_desc) == 0) {
		/*
		 * As a hardening measure, newer kernels don't allow this.
		 */
		printf("[WARN]\tset_thread_area allocated npdata32 at index %d\n",
		       gdt_npdata32_desc.entry_number);
		gdt_npdata32_idx = gdt_npdata32_desc.entry_number;
	} else {
		printf("[OK]\tset_thread_area refused 16-bit data\n");
	}
}

/* State used by our signal handlers. */
static gregset_t initial_regs, requested_regs, resulting_regs;

/* Instructions for the SIGUSR1 handler. */
static volatile unsigned short sig_cs, sig_ss;
static volatile sig_atomic_t sig_trapped, sig_err, sig_trapno;

/* Abstractions for some 32-bit vs 64-bit differences. */
#ifdef __x86_64__
# define REG_IP REG_RIP
# define REG_SP REG_RSP
# define REG_AX REG_RAX

struct selectors {
	unsigned short cs, gs, fs, ss;
};

static unsigned short *ssptr(ucontext_t *ctx)
{
	struct selectors *sels = (void *)&ctx->uc_mcontext.gregs[REG_CSGSFS];
	return &sels->ss;
}

static unsigned short *csptr(ucontext_t *ctx)
{
	struct selectors *sels = (void *)&ctx->uc_mcontext.gregs[REG_CSGSFS];
	return &sels->cs;
}
#else
# define REG_IP REG_EIP
# define REG_SP REG_ESP
# define REG_AX REG_EAX

static greg_t *ssptr(ucontext_t *ctx)
{
	return &ctx->uc_mcontext.gregs[REG_SS];
}

static greg_t *csptr(ucontext_t *ctx)
{
	return &ctx->uc_mcontext.gregs[REG_CS];
}
#endif

/* Number of errors in the current test case. */
static volatile sig_atomic_t nerrs;

/*
 * SIGUSR1 handler.  Sets CS and SS as requested and points IP to the
 * int3 trampoline.  Sets SP to a large known value so that we can see
 * whether the value round-trips back to user mode correctly.
 */
static void sigusr1(int sig, siginfo_t *info, void *ctx_void)
{
	ucontext_t *ctx = (ucontext_t*)ctx_void;

	memcpy(&initial_regs, &ctx->uc_mcontext.gregs, sizeof(gregset_t));

	*csptr(ctx) = sig_cs;
	*ssptr(ctx) = sig_ss;

	ctx->uc_mcontext.gregs[REG_IP] =
		sig_cs == code16_sel ? 0 : (unsigned long)&int3;
	ctx->uc_mcontext.gregs[REG_SP] = (unsigned long)0x8badf00d5aadc0deULL;
	ctx->uc_mcontext.gregs[REG_AX] = 0;

	memcpy(&requested_regs, &ctx->uc_mcontext.gregs, sizeof(gregset_t));
	requested_regs[REG_AX] = *ssptr(ctx);	/* The asm code does this. */

	return;
}

/*
 * Called after a successful sigreturn.  Restores our state so that
 * the original raise(SIGUSR1) returns.
 */
static void sigtrap(int sig, siginfo_t *info, void *ctx_void)
{
	ucontext_t *ctx = (ucontext_t*)ctx_void;

	sig_err = ctx->uc_mcontext.gregs[REG_ERR];
	sig_trapno = ctx->uc_mcontext.gregs[REG_TRAPNO];

	unsigned short ss;
	asm ("mov %%ss,%0" : "=r" (ss));

	greg_t asm_ss = ctx->uc_mcontext.gregs[REG_AX];
	if (asm_ss != sig_ss && sig == SIGTRAP) {
		/* Sanity check failure. */
		printf("[FAIL]\tSIGTRAP: ss = %hx, frame ss = %hx, ax = %llx\n",
		       ss, *ssptr(ctx), (unsigned long long)asm_ss);
		nerrs++;
	}

	memcpy(&resulting_regs, &ctx->uc_mcontext.gregs, sizeof(gregset_t));
	memcpy(&ctx->uc_mcontext.gregs, &initial_regs, sizeof(gregset_t));

	sig_trapped = sig;
}

/*
 * Checks a given selector for its code bitness or returns -1 if it's not
 * a usable code segment selector.
 */
int cs_bitness(unsigned short cs)
{
	uint32_t valid = 0, ar;
	asm ("lar %[cs], %[ar]\n\t"
	     "jnz 1f\n\t"
	     "mov $1, %[valid]\n\t"
	     "1:"
	     : [ar] "=r" (ar), [valid] "+rm" (valid)
	     : [cs] "r" (cs));

	if (!valid)
		return -1;

	bool db = (ar & (1 << 22));
	bool l = (ar & (1 << 21));

	if (!(ar & (1<<11)))
	    return -1;	/* Not code. */

	if (l && !db)
		return 64;
	else if (!l && db)
		return 32;
	else if (!l && !db)
		return 16;
	else
		return -1;	/* Unknown bitness. */
}

/* Finds a usable code segment of the requested bitness. */
int find_cs(int bitness)
{
	unsigned short my_cs;

	asm ("mov %%cs,%0" :  "=r" (my_cs));

	if (cs_bitness(my_cs) == bitness)
		return my_cs;
	if (cs_bitness(my_cs + (2 << 3)) == bitness)
		return my_cs + (2 << 3);
	if (my_cs > (2<<3) && cs_bitness(my_cs - (2 << 3)) == bitness)
	    return my_cs - (2 << 3);
	if (cs_bitness(code16_sel) == bitness)
		return code16_sel;

	printf("[WARN]\tCould not find %d-bit CS\n", bitness);
	return -1;
}

static int test_valid_sigreturn(int cs_bits, bool use_16bit_ss, int force_ss)
{
	int cs = find_cs(cs_bits);
	if (cs == -1) {
		printf("[SKIP]\tCode segment unavailable for %d-bit CS, %d-bit SS\n",
		       cs_bits, use_16bit_ss ? 16 : 32);
		return 0;
	}

	if (force_ss != -1) {
		sig_ss = force_ss;
	} else {
		if (use_16bit_ss) {
			if (!data16_sel) {
				printf("[SKIP]\tData segment unavailable for %d-bit CS, 16-bit SS\n",
				       cs_bits);
				return 0;
			}
			sig_ss = data16_sel;
		} else {
			asm volatile ("mov %%ss,%0" : "=r" (sig_ss));
		}
	}

	sig_cs = cs;

	printf("[RUN]\tValid sigreturn: %d-bit CS (%hx), %d-bit SS (%hx%s)\n",
	       cs_bits, sig_cs, use_16bit_ss ? 16 : 32, sig_ss,
	       (sig_ss & 4) ? "" : ", GDT");

	raise(SIGUSR1);

	nerrs = 0;

	/*
	 * Check that each register had an acceptable value when the
	 * int3 trampoline was invoked.
	 */
	for (int i = 0; i < NGREG; i++) {
		greg_t req = requested_regs[i], res = resulting_regs[i];
		if (i == REG_TRAPNO || i == REG_IP)
			continue;	/* don't care */
		if (i == REG_SP) {
			printf("\tSP: %llx -> %llx\n", (unsigned long long)req,
			       (unsigned long long)res);

			/*
			 * In many circumstances, the high 32 bits of rsp
			 * are zeroed.  For example, we could be a real
			 * 32-bit program, or we could hit any of a number
			 * of poorly-documented IRET or segmented ESP
			 * oddities.  If this happens, it's okay.
			 */
			if (res == (req & 0xFFFFFFFF))
				continue;  /* OK; not expected to work */
		}

		bool ignore_reg = false;
#if __i386__
		if (i == REG_UESP)
			ignore_reg = true;
#else
		if (i == REG_CSGSFS) {
			struct selectors *req_sels =
				(void *)&requested_regs[REG_CSGSFS];
			struct selectors *res_sels =
				(void *)&resulting_regs[REG_CSGSFS];
			if (req_sels->cs != res_sels->cs) {
				printf("[FAIL]\tCS mismatch: requested 0x%hx; got 0x%hx\n",
				       req_sels->cs, res_sels->cs);
				nerrs++;
			}

			if (req_sels->ss != res_sels->ss) {
				printf("[FAIL]\tSS mismatch: requested 0x%hx; got 0x%hx\n",
				       req_sels->ss, res_sels->ss);
				nerrs++;
			}

			continue;
		}
#endif

		/* Sanity check on the kernel */
		if (i == REG_AX && requested_regs[i] != resulting_regs[i]) {
			printf("[FAIL]\tAX (saved SP) mismatch: requested 0x%llx; got 0x%llx\n",
			       (unsigned long long)requested_regs[i],
			       (unsigned long long)resulting_regs[i]);
			nerrs++;
			continue;
		}

		if (requested_regs[i] != resulting_regs[i] && !ignore_reg) {
			/*
			 * SP is particularly interesting here.  The
			 * usual cause of failures is that we hit the
			 * nasty IRET case of returning to a 16-bit SS,
			 * in which case bits 16:31 of the *kernel*
			 * stack pointer persist in ESP.
			 */
			printf("[FAIL]\tReg %d mismatch: requested 0x%llx; got 0x%llx\n",
			       i, (unsigned long long)requested_regs[i],
			       (unsigned long long)resulting_regs[i]);
			nerrs++;
		}
	}

	if (nerrs == 0)
		printf("[OK]\tall registers okay\n");

	return nerrs;
}

static int test_bad_iret(int cs_bits, unsigned short ss, int force_cs)
{
	int cs = force_cs == -1 ? find_cs(cs_bits) : force_cs;
	if (cs == -1)
		return 0;

	sig_cs = cs;
	sig_ss = ss;

	printf("[RUN]\t%d-bit CS (%hx), bogus SS (%hx)\n",
	       cs_bits, sig_cs, sig_ss);

	sig_trapped = 0;
	raise(SIGUSR1);
	if (sig_trapped) {
		char errdesc[32] = "";
		if (sig_err) {
			const char *src = (sig_err & 1) ? " EXT" : "";
			const char *table;
			if ((sig_err & 0x6) == 0x0)
				table = "GDT";
			else if ((sig_err & 0x6) == 0x4)
				table = "LDT";
			else if ((sig_err & 0x6) == 0x2)
				table = "IDT";
			else
				table = "???";

			sprintf(errdesc, "%s%s index %d, ",
				table, src, sig_err >> 3);
		}

		char trapname[32];
		if (sig_trapno == 13)
			strcpy(trapname, "GP");
		else if (sig_trapno == 11)
			strcpy(trapname, "NP");
		else if (sig_trapno == 12)
			strcpy(trapname, "SS");
		else if (sig_trapno == 32)
			strcpy(trapname, "IRET");  /* X86_TRAP_IRET */
		else
			sprintf(trapname, "%d", sig_trapno);

		printf("[OK]\tGot #%s(0x%lx) (i.e. %s%s)\n",
		       trapname, (unsigned long)sig_err,
		       errdesc, strsignal(sig_trapped));
		return 0;
	} else {
		printf("[FAIL]\tDid not get SIGSEGV\n");
		return 1;
	}
}

int main()
{
	int total_nerrs = 0;
	unsigned short my_cs, my_ss;

	asm volatile ("mov %%cs,%0" : "=r" (my_cs));
	asm volatile ("mov %%ss,%0" : "=r" (my_ss));
	setup_ldt();

	stack_t stack = {
		.ss_sp = altstack_data,
		.ss_size = SIGSTKSZ,
	};
	if (sigaltstack(&stack, NULL) != 0)
		err(1, "sigaltstack");

	sethandler(SIGUSR1, sigusr1, 0);
	sethandler(SIGTRAP, sigtrap, SA_ONSTACK);

	/* Easy cases: return to a 32-bit SS in each possible CS bitness. */
	total_nerrs += test_valid_sigreturn(64, false, -1);
	total_nerrs += test_valid_sigreturn(32, false, -1);
	total_nerrs += test_valid_sigreturn(16, false, -1);

	/*
	 * Test easy espfix cases: return to a 16-bit LDT SS in each possible
	 * CS bitness.  NB: with a long mode CS, the SS bitness is irrelevant.
	 *
	 * This catches the original missing-espfix-on-64-bit-kernels issue
	 * as well as CVE-2014-8134.
	 */
	total_nerrs += test_valid_sigreturn(64, true, -1);
	total_nerrs += test_valid_sigreturn(32, true, -1);
	total_nerrs += test_valid_sigreturn(16, true, -1);

	if (gdt_data16_idx) {
		/*
		 * For performance reasons, Linux skips espfix if SS points
		 * to the GDT.  If we were able to allocate a 16-bit SS in
		 * the GDT, see if it leaks parts of the kernel stack pointer.
		 *
		 * This tests for CVE-2014-8133.
		 */
		total_nerrs += test_valid_sigreturn(64, true,
						    GDT3(gdt_data16_idx));
		total_nerrs += test_valid_sigreturn(32, true,
						    GDT3(gdt_data16_idx));
		total_nerrs += test_valid_sigreturn(16, true,
						    GDT3(gdt_data16_idx));
	}

	/*
	 * We're done testing valid sigreturn cases.  Now we test states
	 * for which sigreturn itself will succeed but the subsequent
	 * entry to user mode will fail.
	 *
	 * Depending on the failure mode and the kernel bitness, these
	 * entry failures can generate SIGSEGV, SIGBUS, or SIGILL.
	 */
	clearhandler(SIGTRAP);
	sethandler(SIGSEGV, sigtrap, SA_ONSTACK);
	sethandler(SIGBUS, sigtrap, SA_ONSTACK);
	sethandler(SIGILL, sigtrap, SA_ONSTACK);  /* 32-bit kernels do this */

	/* Easy failures: invalid SS, resulting in #GP(0) */
	test_bad_iret(64, ldt_nonexistent_sel, -1);
	test_bad_iret(32, ldt_nonexistent_sel, -1);
	test_bad_iret(16, ldt_nonexistent_sel, -1);

	/* These fail because SS isn't a data segment, resulting in #GP(SS) */
	test_bad_iret(64, my_cs, -1);
	test_bad_iret(32, my_cs, -1);
	test_bad_iret(16, my_cs, -1);

	/* Try to return to a not-present code segment, triggering #NP(SS). */
	test_bad_iret(32, my_ss, npcode32_sel);

	/*
	 * Try to return to a not-present but otherwise valid data segment.
	 * This will cause IRET to fail with #SS on the espfix stack.  This
	 * exercises CVE-2014-9322.
	 *
	 * Note that, if espfix is enabled, 64-bit Linux will lose track
	 * of the actual cause of failure and report #GP(0) instead.
	 * This would be very difficult for Linux to avoid, because
	 * espfix64 causes IRET failures to be promoted to #DF, so the
	 * original exception frame is never pushed onto the stack.
	 */
	test_bad_iret(32, npdata32_sel, -1);

	/*
	 * Try to return to a not-present but otherwise valid data
	 * segment without invoking espfix.  Newer kernels don't allow
	 * this to happen in the first place.  On older kernels, though,
	 * this can trigger CVE-2014-9322.
	 */
	if (gdt_npdata32_idx)
		test_bad_iret(32, GDT3(gdt_npdata32_idx), -1);

	return total_nerrs ? 1 : 0;
}


text:
module Spring
  module Commands
    class RuboCop
      def env(*)
        'development'
      end

      def exec_name
        'rubocop'
      end
    end

    Spring.register_command 'rubocop', RuboCop.new
  end
end

redpajama_set_name: RedPajamaGithub


text:
class AddViewingTables < ActiveRecord::Migration
  require 'acts_as_viewed'

  def self.up
    ActiveRecord::Base.create_viewings_table
  end

  def self.down
    ActiveRecord::Base.drop_viewings_table
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Selection.ResultSetBuilder (apache-cassandra API)</title>
<meta name="date" content="2015-08-28">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.cassandra.cql3.selection

Class Selection.ResultSetBuilder

java.lang.Object

org.apache.cassandra.cql3.selection.Selection.ResultSetBuilder

Enclosing class:

Selection

public class Selection.ResultSetBuilder
extends java.lang.Object

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

void
add(java.nio.ByteBuffer v)

void
add(Cell c)

ResultSet
build(int protocolVersion)

void
newRow(int protocolVersion)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

add

public void add(java.nio.ByteBuffer v)

add

public void add(Cell c)

newRow

public void newRow(int protocolVersion)
            throws InvalidRequestException

Throws:

InvalidRequestException

build

public ResultSet build(int protocolVersion)
                throws InvalidRequestException

Throws:

InvalidRequestException

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2015 The Apache Software Foundation


text:
set -e

echo "[INITIALIZING taskcat installer!!]"

INSTALL_DIR="/usr/local/bin"
DOCKER_IMAGE_TAG="latest"

if [ $# -eq 1 ]; then
    if [ "${1}" = "--develop" ]; then
        DOCKER_IMAGE_TAG="develop"
        BINARY_SUFFIX="-develop"
    else
        echo "Usage: ${0} [--develop]"
        exit 1
    fi
fi

DOCKER_IMAGE=taskcat/taskcat:${DOCKER_IMAGE_TAG}
TASKCAT_BINARY="taskcat${BINARY_SUFFIX}"
ALCHEMIST_BINARY="alchemist${BINARY_SUFFIX}"

if [ -d "${HOME}"/.aws ]; then
    echo "[INFO] : Found boto profile)"
    echo "[INFO] : Boto profile will map to container during execution"
    echo "echo \"[dockerize]\"" > taskcat.docker
    echo "docker run -it --rm -v ${HOME}/.aws:/root/.aws -v \$(pwd):/mnt ${DOCKER_IMAGE} taskcat \$@" >> taskcat.docker
    echo "docker run -it --rm -v ${HOME}/.aws:/root/.aws -v \$(pwd):/mnt ${DOCKER_IMAGE} alchemist \$@" >> alchemist.docker
else
    echo "echo [dockerize]" > taskcat.docker
    echo "echo [dockerize]" > alchemist.docker
    echo "docker run -it --rm -v \$(pwd):/mnt ${DOCKER_IMAGE} taskcat \$@" >> taskcat.docker
    echo "docker run -it --rm -v \$(pwd):/mnt ${DOCKER_IMAGE} alchemist \$@" >> alchemist.docker
fi

if [ "$(id -u)" -eq 0  ];then
    docker pull ${DOCKER_IMAGE}
    mv taskcat.docker ${INSTALL_DIR}/${TASKCAT_BINARY}
    mv alchemist.docker ${INSTALL_DIR}/${ALCHEMIST_BINARY}
    chmod 755 ${INSTALL_DIR}/${TASKCAT_BINARY}
    chmod 755 ${INSTALL_DIR}/${ALCHEMIST_BINARY}
    echo ""
    echo "\t[i] INSTALL COMPLETE"
    echo "\t[i] tools are installed in => ${INSTALL_DIR}"
else
    docker pull ${DOCKER_IMAGE}
    mv taskcat.docker ${TASKCAT_BINARY}
    mv alchemist.docker ${ALCHEMIST_BINARY}
    chmod 755 ${TASKCAT_BINARY}
    chmod 755 ${ALCHEMIST_BINARY}
    echo ""
    echo "\t[i] INSTALL COMPLETE"
    echo "\t[i] Root privileges were not provided!"
    echo "\t[i] Tools are installed in => $(pwd)"
    echo "\t[i] Please add these tools to your path"
    echo "\t[i] sudo mv ${TASKCAT_BINARY} ${INSTALL_DIR}/${TASKCAT_BINARY} ${INSTALL_DIR}"
    echo "\t[i] sudo mv ${ALCHEMIST_BINARY} ${INSTALL_DIR}/${ALCHEMIST_BINARY} ${INSTALL_DIR}"
    echo "\t[i] or run them from this directory with ./${TASKCAT_BINARY} or ./${ALCHEMIST_BINARY}"
fi

echo "\t[i] To run taskcat the program type ${TASKCAT_BINARY}"
echo "\t[i] To run alchemist the program type ${ALCHEMIST_BINARY}"

echo ""
echo "Ready!!"


text:
require 'spec_helper'

RSpec.describe 'Updating an image DiffNote' do
  include GraphqlHelpers
  using RSpec::Parameterized::TableSyntax

  let_it_be(:noteable) { create(:merge_request, :with_diffs) }
  let_it_be(:original_body) { 'Original body' }
  let_it_be(:original_position) do
    Gitlab::Diff::Position.new(
      old_path: 'files/images/any_image.png',
      new_path: 'files/images/any_image.png',
      width: 10,
      height: 20,
      x: 1,
      y: 2,
      diff_refs: noteable.diff_refs,
      position_type: 'image'
    )
  end
  let_it_be(:updated_body) { 'Updated body' }
  let_it_be(:updated_width) { 50 }
  let_it_be(:updated_height) { 100 }
  let_it_be(:updated_x) { 5 }
  let_it_be(:updated_y) { 10 }
  let(:updated_position) do
    {
      width: updated_width,
      height: updated_height,
      x: updated_x,
      y: updated_y
    }
  end

  let!(:diff_note) do
    create(:image_diff_note_on_merge_request,
           noteable: noteable,
           project: noteable.project,
           note: original_body,
           position: original_position)
  end

  let(:mutation) do
    variables = {
      id: GitlabSchema.id_from_object(diff_note).to_s,
      body: updated_body,
      position: updated_position
    }

    graphql_mutation(:update_image_diff_note, variables)
  end

  def mutation_response
    graphql_mutation_response(:update_image_diff_note)
  end

  context 'when the user does not have permission' do
    let_it_be(:current_user) { create(:user) }

    it_behaves_like 'a mutation that returns a top-level access error'

    it 'does not update the DiffNote' do
      post_graphql_mutation(mutation, current_user: current_user)

      diff_note.reload

      expect(diff_note).to have_attributes(
        note: original_body,
        position: have_attributes(
          width: original_position.width,
          height: original_position.height,
          x: original_position.x,
          y: original_position.y
        )
      )
    end
  end

  context 'when the user has permission' do
    let(:current_user) { diff_note.author }

    it 'updates the DiffNote' do
      post_graphql_mutation(mutation, current_user: current_user)

      diff_note.reload

      expect(diff_note).to have_attributes(
        note: updated_body,
        position: have_attributes(
          width: updated_width,
          height: updated_height,
          x: updated_x,
          y: updated_y
        )
      )
    end

    it 'returns the updated DiffNote' do
      post_graphql_mutation(mutation, current_user: current_user)

      expect(mutation_response['note']).to include(
        'body' => updated_body,
        'position' => hash_including(
          'width' => updated_width,
          'height' => updated_height,
          'x' => updated_x,
          'y' => updated_y
        )
      )
    end

    describe 'updating single properties at a time' do
      where(:property, :new_value) do
        :body | 'foo'
        :width | 19
        :height | 18
        :x | 17
        :y | 16
      end

      with_them do
        # Properties that will be POSTed:
        let(:updated_body) { value(:body) }
        let(:updated_width) { value(:width) }
        let(:updated_height) { value(:height) }
        let(:updated_x) { value(:x) }
        let(:updated_y) { value(:y) }
        # Expectations of the properties:
        let(:expected_body) { value(:body) || original_body }
        let(:expected_width) { value(:width) || original_position.width }
        let(:expected_height) { value(:height) || original_position.height }
        let(:expected_x) { value(:x) || original_position.x }
        let(:expected_y) { value(:y) || original_position.y }

        def value(prop)
          new_value if property == prop
        end

        it 'updates the DiffNote correctly' do
          post_graphql_mutation(mutation, current_user: current_user)

          diff_note.reload

          expect(diff_note).to have_attributes(
            note: expected_body,
            position: have_attributes(
              width: expected_width,
              height: expected_height,
              x: expected_x,
              y: expected_y
            )
          )
        end
      end

      context 'when position is nil' do
        let(:updated_position) { nil }

        it 'updates the DiffNote correctly' do
          post_graphql_mutation(mutation, current_user: current_user)

          diff_note.reload

          expect(diff_note).to have_attributes(
            note: updated_body,
            position: original_position
          )
        end
      end
    end

    context 'when both body and position args are blank' do
      let(:updated_body) { nil }
      let(:updated_position) { nil }

      it_behaves_like 'a mutation that returns top-level errors', errors: ['body or position arguments are required']
    end

    context 'when resource is not a DiffNote on an image' do
      let!(:diff_note) { create(:diff_note_on_merge_request, note: original_body) }

      it_behaves_like 'a mutation that returns top-level errors', errors: ['Resource is not an ImageDiffNote']
    end

    context 'when there are ActiveRecord validation errors' do
      before do
        expect(diff_note).to receive_message_chain(
          :errors,
          :full_messages
        ).and_return(['Error 1', 'Error 2'])

        expect_next_instance_of(Notes::UpdateService) do |service|
          expect(service).to receive(:execute).and_return(diff_note)
        end
      end

      it_behaves_like 'a mutation that returns errors in the response', errors: ['Error 1', 'Error 2']

      it 'does not update the DiffNote' do
        post_graphql_mutation(mutation, current_user: current_user)

        diff_note.reload

        expect(diff_note).to have_attributes(
          note: original_body,
          position: have_attributes(
            width: original_position.width,
            height: original_position.height,
            x: original_position.x,
            y: original_position.y
          )
        )
      end

      it 'returns the DiffNote with its original body' do
        post_graphql_mutation(mutation, current_user: current_user)

        expect(mutation_response['note']).to include(
          'body' => original_body,
          'position' => hash_including(
            'width' => original_position.width,
            'height' => original_position.height,
            'x' => original_position.x,
            'y' => original_position.y
          )
        )
      end
    end

    context 'when body only contains quick actions' do
      let(:updated_body) { '/close' }

      it 'returns a nil note and empty errors' do
        post_graphql_mutation(mutation, current_user: current_user)

        expect(mutation_response).to include(
          'errors' => [],
          'note' => nil
        )
      end
    end
  end
end


text:
package org.mondo.collaboration.security.query;

import java.util.Arrays;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.incquery.runtime.api.IPatternMatch;
import org.eclipse.incquery.runtime.api.impl.BasePatternMatch;
import org.eclipse.incquery.runtime.exception.IncQueryException;
import org.mondo.collaboration.security.query.util.ObjectobjectQuerySpecification;

/**
 * Pattern-specific match representation of the org.mondo.collaboration.security.query.objectobject pattern,
 * to be used in conjunction with {@link ObjectobjectMatcher}.
 *
 *
Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
 * Each instance is a (possibly partial) substitution of pattern parameters,
 * usable to represent a match of the pattern in the result of a query,
 * or to specify the bound (fixed) input parameters when issuing a query.
 *
 * @see ObjectobjectMatcher
 * @see ObjectobjectProcessor
 *
 */
@SuppressWarnings("all")
public abstract class ObjectobjectMatch extends BasePatternMatch {
  private EObject fObject;

  private static List<String> parameterNames = makeImmutableList("object");

  private ObjectobjectMatch(final EObject pObject) {
    this.fObject = pObject;
  }

  @Override
  public Object get(final String parameterName) {
    if ("object".equals(parameterName)) return this.fObject;
    return null;
  }

  public EObject getObject() {
    return this.fObject;
  }

  @Override
  public boolean set(final String parameterName, final Object newValue) {
    if (!isMutable()) throw new java.lang.UnsupportedOperationException();
    if ("object".equals(parameterName) ) {
    	this.fObject = (org.eclipse.emf.ecore.EObject) newValue;
    	return true;
    }
    return false;
  }

  public void setObject(final EObject pObject) {
    if (!isMutable()) throw new java.lang.UnsupportedOperationException();
    this.fObject = pObject;
  }

  @Override
  public String patternName() {
    return "org.mondo.collaboration.security.query.objectobject";
  }

  @Override
  public List<String> parameterNames() {
    return ObjectobjectMatch.parameterNames;
  }

  @Override
  public Object[] toArray() {
    return new Object[]{fObject};
  }

  @Override
  public ObjectobjectMatch toImmutable() {
    return isMutable() ? newMatch(fObject) : this;
  }

  @Override
  public String prettyPrint() {
    StringBuilder result = new StringBuilder();
    result.append("\"object\"=" + prettyPrintValue(fObject)
    );
    return result.toString();
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((fObject == null) ? 0 : fObject.hashCode());
    return result;
  }

  @Override
  public boolean equals(final Object obj) {
    if (this == obj)
    	return true;
    if (!(obj instanceof ObjectobjectMatch)) { // this should be infrequent
    	if (obj == null) {
    		return false;
    	}
    	if (!(obj instanceof IPatternMatch)) {
    		return false;
    	}
    	IPatternMatch otherSig  = (IPatternMatch) obj;
    	if (!specification().equals(otherSig.specification()))
    		return false;
    	return Arrays.deepEquals(toArray(), otherSig.toArray());
    }
    ObjectobjectMatch other = (ObjectobjectMatch) obj;
    if (fObject == null) {if (other.fObject != null) return false;}
    else if (!fObject.equals(other.fObject)) return false;
    return true;
  }

  @Override
  public ObjectobjectQuerySpecification specification() {
    try {
    	return ObjectobjectQuerySpecification.instance();
    } catch (IncQueryException ex) {
     	// This cannot happen, as the match object can only be instantiated if the query specification exists
     	throw new IllegalStateException (ex);
    }
  }

  /**
   * Returns an empty, mutable match.
   * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
   *
   * @return the empty match.
   *
   */
  public static ObjectobjectMatch newEmptyMatch() {
    return new Mutable(null);
  }

  /**
   * Returns a mutable (partial) match.
   * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
   *
   * @param pObject the fixed value of pattern parameter object, or null if not bound.
   * @return the new, mutable (partial) match object.
   *
   */
  public static ObjectobjectMatch newMutableMatch(final EObject pObject) {
    return new Mutable(pObject);
  }

  /**
   * Returns a new (partial) match.
   * This can be used e.g. to call the matcher with a partial match.
   *
The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
   * @param pObject the fixed value of pattern parameter object, or null if not bound.
   * @return the (partial) match object.
   *
   */
  public static ObjectobjectMatch newMatch(final EObject pObject) {
    return new Immutable(pObject);
  }

  private static final class Mutable extends ObjectobjectMatch {
    Mutable(final EObject pObject) {
      super(pObject);
    }

    @Override
    public boolean isMutable() {
      return true;
    }
  }

  private static final class Immutable extends ObjectobjectMatch {
    Immutable(final EObject pObject) {
      super(pObject);
    }

    @Override
    public boolean isMutable() {
      return false;
    }
  }
}


text:
#pragma once
#include <aws/lightsail/Lightsail_EXPORTS.h>
#include <aws/lightsail/LightsailRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/lightsail/model/IpAddressType.h>
#include <aws/lightsail/model/Tag.h>
#include <utility>

namespace Aws
{
namespace Lightsail
{
namespace Model
{

  /**
   */
  class AWS_LIGHTSAIL_API CreateLoadBalancerRequest : public LightsailRequest
  {
  public:
    CreateLoadBalancerRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "CreateLoadBalancer"; }

    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
The name of your load balancer.

     */
    inline const Aws::String& GetLoadBalancerName() const{ return m_loadBalancerName; }

    /**
     *
The name of your load balancer.

     */
    inline bool LoadBalancerNameHasBeenSet() const { return m_loadBalancerNameHasBeenSet; }

    /**
     *
The name of your load balancer.

     */
    inline void SetLoadBalancerName(const Aws::String& value) { m_loadBalancerNameHasBeenSet = true; m_loadBalancerName = value; }

    /**
     *
The name of your load balancer.

     */
    inline void SetLoadBalancerName(Aws::String&& value) { m_loadBalancerNameHasBeenSet = true; m_loadBalancerName = std::move(value); }

    /**
     *
The name of your load balancer.

     */
    inline void SetLoadBalancerName(const char* value) { m_loadBalancerNameHasBeenSet = true; m_loadBalancerName.assign(value); }

    /**
     *
The name of your load balancer.

     */
    inline CreateLoadBalancerRequest& WithLoadBalancerName(const Aws::String& value) { SetLoadBalancerName(value); return *this;}

    /**
     *
The name of your load balancer.

     */
    inline CreateLoadBalancerRequest& WithLoadBalancerName(Aws::String&& value) { SetLoadBalancerName(std::move(value)); return *this;}

    /**
     *
The name of your load balancer.

     */
    inline CreateLoadBalancerRequest& WithLoadBalancerName(const char* value) { SetLoadBalancerName(value); return *this;}

    /**
     *
The instance port where you're creating your load balancer.

     */
    inline int GetInstancePort() const{ return m_instancePort; }

    /**
     *
The instance port where you're creating your load balancer.

     */
    inline bool InstancePortHasBeenSet() const { return m_instancePortHasBeenSet; }

    /**
     *
The instance port where you're creating your load balancer.

     */
    inline void SetInstancePort(int value) { m_instancePortHasBeenSet = true; m_instancePort = value; }

    /**
     *
The instance port where you're creating your load balancer.

     */
    inline CreateLoadBalancerRequest& WithInstancePort(int value) { SetInstancePort(value); return *this;}

    /**
     *
The path you provided to perform the load balancer health check. If you
     * didn't specify a health check path, Lightsail uses the root path of your website
     * (e.g., "/").

You may want to specify a custom health check
     * path other than the root of your application if your home page loads slowly or
     * has a lot of media or scripting on it.

     */
    inline const Aws::String& GetHealthCheckPath() const{ return m_healthCheckPath; }

    /**
     *
The path you provided to perform the load balancer health check. If you
     * didn't specify a health check path, Lightsail uses the root path of your website
     * (e.g., "/").

You may want to specify a custom health check
     * path other than the root of your application if your home page loads slowly or
     * has a lot of media or scripting on it.

     */
    inline bool HealthCheckPathHasBeenSet() const { return m_healthCheckPathHasBeenSet; }

    /**
     *
The path you provided to perform the load balancer health check. If you
     * didn't specify a health check path, Lightsail uses the root path of your website
     * (e.g., "/").

You may want to specify a custom health check
     * path other than the root of your application if your home page loads slowly or
     * has a lot of media or scripting on it.

     */
    inline void SetHealthCheckPath(const Aws::String& value) { m_healthCheckPathHasBeenSet = true; m_healthCheckPath = value; }

    /**
     *
The path you provided to perform the load balancer health check. If you
     * didn't specify a health check path, Lightsail uses the root path of your website
     * (e.g., "/").

You may want to specify a custom health check
     * path other than the root of your application if your home page loads slowly or
     * has a lot of media or scripting on it.

     */
    inline void SetHealthCheckPath(Aws::String&& value) { m_healthCheckPathHasBeenSet = true; m_healthCheckPath = std::move(value); }

    /**
     *
The path you provided to perform the load balancer health check. If you
     * didn't specify a health check path, Lightsail uses the root path of your website
     * (e.g., "/").

You may want to specify a custom health check
     * path other than the root of your application if your home page loads slowly or
     * has a lot of media or scripting on it.

     */
    inline void SetHealthCheckPath(const char* value) { m_healthCheckPathHasBeenSet = true; m_healthCheckPath.assign(value); }

    /**
     *
The path you provided to perform the load balancer health check. If you
     * didn't specify a health check path, Lightsail uses the root path of your website
     * (e.g., "/").

You may want to specify a custom health check
     * path other than the root of your application if your home page loads slowly or
     * has a lot of media or scripting on it.

     */
    inline CreateLoadBalancerRequest& WithHealthCheckPath(const Aws::String& value) { SetHealthCheckPath(value); return *this;}

    /**
     *
The path you provided to perform the load balancer health check. If you
     * didn't specify a health check path, Lightsail uses the root path of your website
     * (e.g., "/").

You may want to specify a custom health check
     * path other than the root of your application if your home page loads slowly or
     * has a lot of media or scripting on it.

     */
    inline CreateLoadBalancerRequest& WithHealthCheckPath(Aws::String&& value) { SetHealthCheckPath(std::move(value)); return *this;}

    /**
     *
The path you provided to perform the load balancer health check. If you
     * didn't specify a health check path, Lightsail uses the root path of your website
     * (e.g., "/").

You may want to specify a custom health check
     * path other than the root of your application if your home page loads slowly or
     * has a lot of media or scripting on it.

     */
    inline CreateLoadBalancerRequest& WithHealthCheckPath(const char* value) { SetHealthCheckPath(value); return *this;}

    /**
     *
The name of the SSL/TLS certificate.

If you specify
     * certificateName, then certificateDomainName is
     * required (and vice-versa).

     */
    inline const Aws::String& GetCertificateName() const{ return m_certificateName; }

    /**
     *
The name of the SSL/TLS certificate.

If you specify
     * certificateName, then certificateDomainName is
     * required (and vice-versa).

     */
    inline bool CertificateNameHasBeenSet() const { return m_certificateNameHasBeenSet; }

    /**
     *
The name of the SSL/TLS certificate.

If you specify
     * certificateName, then certificateDomainName is
     * required (and vice-versa).

     */
    inline void SetCertificateName(const Aws::String& value) { m_certificateNameHasBeenSet = true; m_certificateName = value; }

    /**
     *
The name of the SSL/TLS certificate.

If you specify
     * certificateName, then certificateDomainName is
     * required (and vice-versa).

     */
    inline void SetCertificateName(Aws::String&& value) { m_certificateNameHasBeenSet = true; m_certificateName = std::move(value); }

    /**
     *
The name of the SSL/TLS certificate.

If you specify
     * certificateName, then certificateDomainName is
     * required (and vice-versa).

     */
    inline void SetCertificateName(const char* value) { m_certificateNameHasBeenSet = true; m_certificateName.assign(value); }

    /**
     *
The name of the SSL/TLS certificate.

If you specify
     * certificateName, then certificateDomainName is
     * required (and vice-versa).

     */
    inline CreateLoadBalancerRequest& WithCertificateName(const Aws::String& value) { SetCertificateName(value); return *this;}

    /**
     *
The name of the SSL/TLS certificate.

If you specify
     * certificateName, then certificateDomainName is
     * required (and vice-versa).

     */
    inline CreateLoadBalancerRequest& WithCertificateName(Aws::String&& value) { SetCertificateName(std::move(value)); return *this;}

    /**
     *
The name of the SSL/TLS certificate.

If you specify
     * certificateName, then certificateDomainName is
     * required (and vice-versa).

     */
    inline CreateLoadBalancerRequest& WithCertificateName(const char* value) { SetCertificateName(value); return *this;}

    /**
     *
The domain name with which your certificate is associated (e.g.,
     * example.com).

If you specify
     * certificateDomainName, then certificateName is
     * required (and vice-versa).

     */
    inline const Aws::String& GetCertificateDomainName() const{ return m_certificateDomainName; }

    /**
     *
The domain name with which your certificate is associated (e.g.,
     * example.com).

If you specify
     * certificateDomainName, then certificateName is
     * required (and vice-versa).

     */
    inline bool CertificateDomainNameHasBeenSet() const { return m_certificateDomainNameHasBeenSet; }

    /**
     *
The domain name with which your certificate is associated (e.g.,
     * example.com).

If you specify
     * certificateDomainName, then certificateName is
     * required (and vice-versa).

     */
    inline void SetCertificateDomainName(const Aws::String& value) { m_certificateDomainNameHasBeenSet = true; m_certificateDomainName = value; }

    /**
     *
The domain name with which your certificate is associated (e.g.,
     * example.com).

If you specify
     * certificateDomainName, then certificateName is
     * required (and vice-versa).

     */
    inline void SetCertificateDomainName(Aws::String&& value) { m_certificateDomainNameHasBeenSet = true; m_certificateDomainName = std::move(value); }

    /**
     *
The domain name with which your certificate is associated (e.g.,
     * example.com).

If you specify
     * certificateDomainName, then certificateName is
     * required (and vice-versa).

     */
    inline void SetCertificateDomainName(const char* value) { m_certificateDomainNameHasBeenSet = true; m_certificateDomainName.assign(value); }

    /**
     *
The domain name with which your certificate is associated (e.g.,
     * example.com).

If you specify
     * certificateDomainName, then certificateName is
     * required (and vice-versa).

     */
    inline CreateLoadBalancerRequest& WithCertificateDomainName(const Aws::String& value) { SetCertificateDomainName(value); return *this;}

    /**
     *
The domain name with which your certificate is associated (e.g.,
     * example.com).

If you specify
     * certificateDomainName, then certificateName is
     * required (and vice-versa).

     */
    inline CreateLoadBalancerRequest& WithCertificateDomainName(Aws::String&& value) { SetCertificateDomainName(std::move(value)); return *this;}

    /**
     *
The domain name with which your certificate is associated (e.g.,
     * example.com).

If you specify
     * certificateDomainName, then certificateName is
     * required (and vice-versa).

     */
    inline CreateLoadBalancerRequest& WithCertificateDomainName(const char* value) { SetCertificateDomainName(value); return *this;}

    /**
     *
The optional alternative domains and subdomains to use with your SSL/TLS
     * certificate (e.g., www.example.com, example.com,
     * m.example.com, blog.example.com).

     */
    inline const Aws::Vector<Aws::String>& GetCertificateAlternativeNames() const{ return m_certificateAlternativeNames; }

    /**
     *
The optional alternative domains and subdomains to use with your SSL/TLS
     * certificate (e.g., www.example.com, example.com,
     * m.example.com, blog.example.com).

     */
    inline bool CertificateAlternativeNamesHasBeenSet() const { return m_certificateAlternativeNamesHasBeenSet; }

    /**
     *
The optional alternative domains and subdomains to use with your SSL/TLS
     * certificate (e.g., www.example.com, example.com,
     * m.example.com, blog.example.com).

     */
    inline void SetCertificateAlternativeNames(const Aws::Vector<Aws::String>& value) { m_certificateAlternativeNamesHasBeenSet = true; m_certificateAlternativeNames = value; }

    /**
     *
The optional alternative domains and subdomains to use with your SSL/TLS
     * certificate (e.g., www.example.com, example.com,
     * m.example.com, blog.example.com).

     */
    inline void SetCertificateAlternativeNames(Aws::Vector<Aws::String>&& value) { m_certificateAlternativeNamesHasBeenSet = true; m_certificateAlternativeNames = std::move(value); }

    /**
     *
The optional alternative domains and subdomains to use with your SSL/TLS
     * certificate (e.g., www.example.com, example.com,
     * m.example.com, blog.example.com).

     */
    inline CreateLoadBalancerRequest& WithCertificateAlternativeNames(const Aws::Vector<Aws::String>& value) { SetCertificateAlternativeNames(value); return *this;}

    /**
     *
The optional alternative domains and subdomains to use with your SSL/TLS
     * certificate (e.g., www.example.com, example.com,
     * m.example.com, blog.example.com).

     */
    inline CreateLoadBalancerRequest& WithCertificateAlternativeNames(Aws::Vector<Aws::String>&& value) { SetCertificateAlternativeNames(std::move(value)); return *this;}

    /**
     *
The optional alternative domains and subdomains to use with your SSL/TLS
     * certificate (e.g., www.example.com, example.com,
     * m.example.com, blog.example.com).

     */
    inline CreateLoadBalancerRequest& AddCertificateAlternativeNames(const Aws::String& value) { m_certificateAlternativeNamesHasBeenSet = true; m_certificateAlternativeNames.push_back(value); return *this; }

    /**
     *
The optional alternative domains and subdomains to use with your SSL/TLS
     * certificate (e.g., www.example.com, example.com,
     * m.example.com, blog.example.com).

     */
    inline CreateLoadBalancerRequest& AddCertificateAlternativeNames(Aws::String&& value) { m_certificateAlternativeNamesHasBeenSet = true; m_certificateAlternativeNames.push_back(std::move(value)); return *this; }

    /**
     *
The optional alternative domains and subdomains to use with your SSL/TLS
     * certificate (e.g., www.example.com, example.com,
     * m.example.com, blog.example.com).

     */
    inline CreateLoadBalancerRequest& AddCertificateAlternativeNames(const char* value) { m_certificateAlternativeNamesHasBeenSet = true; m_certificateAlternativeNames.push_back(value); return *this; }

    /**
     *
The tag keys and optional values to add to the resource during create.

     *
Use the TagResource action to tag a resource after it's
     * created.

     */
    inline const Aws::Vector<Tag>& GetTags() const{ return m_tags; }

    /**
     *
The tag keys and optional values to add to the resource during create.

     *
Use the TagResource action to tag a resource after it's
     * created.

     */
    inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; }

    /**
     *
The tag keys and optional values to add to the resource during create.

     *
Use the TagResource action to tag a resource after it's
     * created.

     */
    inline void SetTags(const Aws::Vector<Tag>& value) { m_tagsHasBeenSet = true; m_tags = value; }

    /**
     *
The tag keys and optional values to add to the resource during create.

     *
Use the TagResource action to tag a resource after it's
     * created.

     */
    inline void SetTags(Aws::Vector<Tag>&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); }

    /**
     *
The tag keys and optional values to add to the resource during create.

     *
Use the TagResource action to tag a resource after it's
     * created.

     */
    inline CreateLoadBalancerRequest& WithTags(const Aws::Vector<Tag>& value) { SetTags(value); return *this;}

    /**
     *
The tag keys and optional values to add to the resource during create.

     *
Use the TagResource action to tag a resource after it's
     * created.

     */
    inline CreateLoadBalancerRequest& WithTags(Aws::Vector<Tag>&& value) { SetTags(std::move(value)); return *this;}

    /**
     *
The tag keys and optional values to add to the resource during create.

     *
Use the TagResource action to tag a resource after it's
     * created.

     */
    inline CreateLoadBalancerRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; }

    /**
     *
The tag keys and optional values to add to the resource during create.

     *
Use the TagResource action to tag a resource after it's
     * created.

     */
    inline CreateLoadBalancerRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; }

    /**
     *
The IP address type for the load balancer.

The possible values are
     * ipv4 for IPv4 only, and dualstack for IPv4 and
     * IPv6.

The default value is dualstack.

     */
    inline const IpAddressType& GetIpAddressType() const{ return m_ipAddressType; }

    /**
     *
The IP address type for the load balancer.

The possible values are
     * ipv4 for IPv4 only, and dualstack for IPv4 and
     * IPv6.

The default value is dualstack.

     */
    inline bool IpAddressTypeHasBeenSet() const { return m_ipAddressTypeHasBeenSet; }

    /**
     *
The IP address type for the load balancer.

The possible values are
     * ipv4 for IPv4 only, and dualstack for IPv4 and
     * IPv6.

The default value is dualstack.

     */
    inline void SetIpAddressType(const IpAddressType& value) { m_ipAddressTypeHasBeenSet = true; m_ipAddressType = value; }

    /**
     *
The IP address type for the load balancer.

The possible values are
     * ipv4 for IPv4 only, and dualstack for IPv4 and
     * IPv6.

The default value is dualstack.

     */
    inline void SetIpAddressType(IpAddressType&& value) { m_ipAddressTypeHasBeenSet = true; m_ipAddressType = std::move(value); }

    /**
     *
The IP address type for the load balancer.

The possible values are
     * ipv4 for IPv4 only, and dualstack for IPv4 and
     * IPv6.

The default value is dualstack.

     */
    inline CreateLoadBalancerRequest& WithIpAddressType(const IpAddressType& value) { SetIpAddressType(value); return *this;}

    /**
     *
The IP address type for the load balancer.

The possible values are
     * ipv4 for IPv4 only, and dualstack for IPv4 and
     * IPv6.

The default value is dualstack.

     */
    inline CreateLoadBalancerRequest& WithIpAddressType(IpAddressType&& value) { SetIpAddressType(std::move(value)); return *this;}

    /**
     *
The name of the TLS policy to apply to the load balancer.

Use the GetLoadBalancerTlsPolicies
     * action to get a list of TLS policy names that you can specify.

For more
     * information about load balancer TLS policies, see Configuring
     * TLS security policies on your Amazon Lightsail load balancers in the
     * Amazon Lightsail Developer Guide.

     */
    inline const Aws::String& GetTlsPolicyName() const{ return m_tlsPolicyName; }

    /**
     *
The name of the TLS policy to apply to the load balancer.

Use the GetLoadBalancerTlsPolicies
     * action to get a list of TLS policy names that you can specify.

For more
     * information about load balancer TLS policies, see Configuring
     * TLS security policies on your Amazon Lightsail load balancers in the
     * Amazon Lightsail Developer Guide.

     */
    inline bool TlsPolicyNameHasBeenSet() const { return m_tlsPolicyNameHasBeenSet; }

    /**
     *
The name of the TLS policy to apply to the load balancer.

Use the GetLoadBalancerTlsPolicies
     * action to get a list of TLS policy names that you can specify.

For more
     * information about load balancer TLS policies, see Configuring
     * TLS security policies on your Amazon Lightsail load balancers in the
     * Amazon Lightsail Developer Guide.

     */
    inline void SetTlsPolicyName(const Aws::String& value) { m_tlsPolicyNameHasBeenSet = true; m_tlsPolicyName = value; }

    /**
     *
The name of the TLS policy to apply to the load balancer.

Use the GetLoadBalancerTlsPolicies
     * action to get a list of TLS policy names that you can specify.

For more
     * information about load balancer TLS policies, see Configuring
     * TLS security policies on your Amazon Lightsail load balancers in the
     * Amazon Lightsail Developer Guide.

     */
    inline void SetTlsPolicyName(Aws::String&& value) { m_tlsPolicyNameHasBeenSet = true; m_tlsPolicyName = std::move(value); }

    /**
     *
The name of the TLS policy to apply to the load balancer.

Use the GetLoadBalancerTlsPolicies
     * action to get a list of TLS policy names that you can specify.

For more
     * information about load balancer TLS policies, see Configuring
     * TLS security policies on your Amazon Lightsail load balancers in the
     * Amazon Lightsail Developer Guide.

     */
    inline void SetTlsPolicyName(const char* value) { m_tlsPolicyNameHasBeenSet = true; m_tlsPolicyName.assign(value); }

    /**
     *
The name of the TLS policy to apply to the load balancer.

Use the GetLoadBalancerTlsPolicies
     * action to get a list of TLS policy names that you can specify.

For more
     * information about load balancer TLS policies, see Configuring
     * TLS security policies on your Amazon Lightsail load balancers in the
     * Amazon Lightsail Developer Guide.

     */
    inline CreateLoadBalancerRequest& WithTlsPolicyName(const Aws::String& value) { SetTlsPolicyName(value); return *this;}

    /**
     *
The name of the TLS policy to apply to the load balancer.

Use the GetLoadBalancerTlsPolicies
     * action to get a list of TLS policy names that you can specify.

For more
     * information about load balancer TLS policies, see Configuring
     * TLS security policies on your Amazon Lightsail load balancers in the
     * Amazon Lightsail Developer Guide.

     */
    inline CreateLoadBalancerRequest& WithTlsPolicyName(Aws::String&& value) { SetTlsPolicyName(std::move(value)); return *this;}

    /**
     *
The name of the TLS policy to apply to the load balancer.

Use the GetLoadBalancerTlsPolicies
     * action to get a list of TLS policy names that you can specify.

For more
     * information about load balancer TLS policies, see Configuring
     * TLS security policies on your Amazon Lightsail load balancers in the
     * Amazon Lightsail Developer Guide.

     */
    inline CreateLoadBalancerRequest& WithTlsPolicyName(const char* value) { SetTlsPolicyName(value); return *this;}

  private:

    Aws::String m_loadBalancerName;
    bool m_loadBalancerNameHasBeenSet = false;

    int m_instancePort;
    bool m_instancePortHasBeenSet = false;

    Aws::String m_healthCheckPath;
    bool m_healthCheckPathHasBeenSet = false;

    Aws::String m_certificateName;
    bool m_certificateNameHasBeenSet = false;

    Aws::String m_certificateDomainName;
    bool m_certificateDomainNameHasBeenSet = false;

    Aws::Vector<Aws::String> m_certificateAlternativeNames;
    bool m_certificateAlternativeNamesHasBeenSet = false;

    Aws::Vector<Tag> m_tags;
    bool m_tagsHasBeenSet = false;

    IpAddressType m_ipAddressType;
    bool m_ipAddressTypeHasBeenSet = false;

    Aws::String m_tlsPolicyName;
    bool m_tlsPolicyNameHasBeenSet = false;
  };

} // namespace Model
} // namespace Lightsail
} // namespace Aws


text:
A centralized home management system; rent payment/lease administration, IoT integration, maintenance reminders, dashboards

See the splash page at [http://cute.casa](http://cute.casa).

## Overview

CuteCasa is a self-hosted house administration system. Through online dashboards, you can control every aspect of your
IoT-enabled house, split bills, manage rent, delegate tasks, and more.

## Technologies

* Python
* * Flask
* jQuery
* Sass
* [Bulma](http://bulma.io)

## Setup

Being a self-hosted solution, you'll need to run this on your own equipment. The cute.casa website is intended for
future paid/dedicated hosting.

### Requirements

* Python (3.5+)
* * [Flask](http://flask.pocoo.org/)
* * [ZODB](http://www.zodb.org/en/latest/)
* [Sass](http://sass-lang.com/) (`sass`)
* [Typescript](https://www.typescriptlang.org/) (`tsc`)

### Running CuteCasa

Create a shell script to load the variables in cute.py and to launch the program:

    #!/bin/sh
    export CUTE_DB="config/secret/cute.db"
    export CUTE_DEBUG="False"
    export CUTE_SECRET_KEY="set a secret development key"
    export CUTE_USERNAME="admin"
    export CUTE_PASSWORD="set a secret password"
    export CUTE_PORT="5050"
    export CUTE_SALT="16 or so good random bytes"
    python3 cute.py

Set it executable (`chmod +x run.sh`) and run it (`./run.sh`). If everything's set up correctly, CuteCasa will now be
running on your server. Obviously don't commit this file into VCS.

## Contributors

[Alex Kersten](http://kersten.email)


text:
#import "SNRSearchIndex-SNRAdditions.h"
#import "NSString-SNRAdditions.h"

@implementation SNRSearchIndex (SNRAdditions)
- (BOOL)updateSearchIndexForSonoraObject:(NSManagedObject*)object
{
    NSString *name = [object valueForKey:@"name"];
    NSManagedObjectID *identifier = [object objectID];
    if ([identifier isTemporaryID]) {
        if (![object.managedObjectContext obtainPermanentIDsForObjects:[NSArray arrayWithObject:object] error:nil]) {
            return NO;
        }
        identifier = [object objectID];
    }
    [self setKeywords:[name spaceSeparatedComponents] forObjectID:identifier];
    return YES;
}
@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ScalaSbtSettings">
    <option name="customLauncherPath" value="C:\Program Files (x86)\sbt\bin\sbt-launch.jar" />
    <option name="customVMPath" value="C:\Program Files\Java\jdk1.8.0_92" />
    <option name="maximumHeapSize" value="2048" />
    <option name="vmParameters" value="-XX:MaxPermSize=1024M" />
  </component>
</project>


text:
@interface ProductListModel : JSONModel

@property (nonatomic, strong) NSArray<ProductModel, Optional> *products;
@property (nonatomic, strong) PagerModel<Optional> *pager;
@property (nonatomic, strong) NSArray<OrderModel, Optional> *orderby;

@end


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE126_Buffer_Overread__new_char_loop_45.cpp
Label Definition File: CWE126_Buffer_Overread__new.label.xml
Template File: sources-sink-45.tmpl.cpp
*/
/*
 * @description
 * CWE: 126 Buffer Over-read
 * BadSource:  Use a small buffer
 * GoodSource: Use a large buffer
 * Sinks: loop
 *    BadSink : Copy data to string using a loop
 * Flow Variant: 45 Data flow: data passed as a static global variable from one function to another in the same source file
 *
 * */

#include "std_testcase.h"

#include <wchar.h>

namespace CWE126_Buffer_Overread__new_char_loop_45
{

static char * badData;
static char * goodG2BData;

#ifndef OMITBAD

static void badSink()
{
    char * data = badData;
    {
        size_t i, destLen;
        char dest[100];
        memset(dest, 'C', 100-1);
        dest[100-1] = '\0'; /* null terminate */
        destLen = strlen(dest);
        /* POTENTIAL FLAW: using length of the dest where data
         * could be smaller than dest causing buffer overread */
        for (i = 0; i < destLen; i++)
        {
            dest[i] = data[i];
        }
        dest[100-1] = '\0';
        printLine(dest);
        delete [] data;
    }
}

void bad()
{
    char * data;
    data = NULL;
    /* FLAW: Use a small buffer */
    data = new char[50];
    memset(data, 'A', 50-1); /* fill with 'A's */
    data[50-1] = '\0'; /* null terminate */
    badData = data;
    badSink();
}

#endif /* OMITBAD */

#ifndef OMITGOOD

/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2BSink()
{
    char * data = goodG2BData;
    {
        size_t i, destLen;
        char dest[100];
        memset(dest, 'C', 100-1);
        dest[100-1] = '\0'; /* null terminate */
        destLen = strlen(dest);
        /* POTENTIAL FLAW: using length of the dest where data
         * could be smaller than dest causing buffer overread */
        for (i = 0; i < destLen; i++)
        {
            dest[i] = data[i];
        }
        dest[100-1] = '\0';
        printLine(dest);
        delete [] data;
    }
}

static void goodG2B()
{
    char * data;
    data = NULL;
    /* FIX: Use a large buffer */
    data = new char[100];
    memset(data, 'A', 100-1); /* fill with 'A's */
    data[100-1] = '\0'; /* null terminate */
    goodG2BData = data;
    goodG2BSink();
}

void good()
{
    goodG2B();
}

#endif /* OMITGOOD */

} /* close namespace */

/* Below is the main(). It is only used when building this testcase on
   its own for testing or for building a binary to use in testing binary
   analysis tools. It is not used when compiling all the testcases as one
   application, which is how source code analysis tools are tested. */

#ifdef INCLUDEMAIN

using namespace CWE126_Buffer_Overread__new_char_loop_45; /* so that we can use good and bad easily */

int main(int argc, char * argv[])
{
    /* seed randomness */
    srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
    printLine("Calling good()...");
    good();
    printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
    printLine("Calling bad()...");
    bad();
    printLine("Finished bad()");
#endif /* OMITBAD */
    return 0;
}

#endif


text:
package test.hd.my.test;

import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import static java.lang.Thread.sleep;

public class DoucumentView {
    FirefoxDriver wd;

    @BeforeMethod
    public
    void setUp () throws Exception {
        wd = new FirefoxDriver();
        wd.get("https://hd-itis-ea.cognitran-cloud.com/sip/index");
        sleep(1000);
        wd.findElement(By.xpath("//div[3]/div/div[2]/div/div/div[3]/div[1]/div")).click();
        sleep(1000);
        wd.findElement(By.xpath("//div[6]/div/div[2]/div/div/div[3]/div/div[1]/div/div[2]/a/i")).click();
        sleep(1000);
        wd.findElement(By.xpath("//div[6]/div/div[3]/button")).click();
        sleep(1000);
        wd.findElement(By.xpath("//div[1]/div/div/div/div[1]/div/div[2]/div/div/a")).click();
        sleep(1000);
        wd.findElement(By.id("login_username")).click();
        wd.findElement(By.id("login_username")).clear();
        wd.findElement(By.id("login_username")).sendKeys("administratorka");
        wd.findElement(By.id("login_password")).click();
        wd.findElement(By.id("login_password")).clear();
        wd.findElement(By.id("login_password")).sendKeys("Demonwera1");
        wd.findElement(By.id("login_password")).click();
        wd.findElement(By.id("login-submit")).click();
    }

    @Test
    public
    void testDoucumentView () throws InterruptedException {
        //favotite selector
        sleep(2000);
        wd.findElement(By.xpath("//div/div/div/div/div/div/div/div/div[1]/button")).click();
        sleep(1000);
        wd.findElement(By.xpath("//div[1]/div/div/div/div/div[1]/div/div[1]/div[1]/ul/div[2]/li[1]/a/div/div[2]/ul/li[1]")).click();

        // document selector
        sleep(6000);
        wd.findElement(By.xpath("//div/div/div/ul/li[4]/a")).click();
        sleep(3000);
        wd.findElement(By.xpath("//div[@class='body']/div/div/ul/li[1]/a")).click();
        sleep(2000);
        wd.findElement(By.xpath("//table[@id='document-link-table']/tbody/tr[2]/td[2]/a")).click();
        sleep(2000);
        wd.switchTo().frame("documentViewContent");
        sleep(2000);
        wd.findElement(By.xpath("//div[@class='document-content']/div[1]/ul/li[2]/span")).click();
        sleep(2000);
        wd.findElement(By.xpath("//div[@class='document-content']/div/ul/li[2]/ul/li[1]/span")).click();
        sleep(2000);
        wd.findElement(By.xpath("//div[@class='document-content']/div[1]/ul/li[2]/ul/li[1]/ul/li[2]/a")).click();
    }
    }


text:
package org.kodejava.example.swing;

import javax.swing.*;
import java.awt.*;
import java.util.GregorianCalendar;
import java.util.Calendar;

public class JSpinnerDate extends JFrame {
    public JSpinnerDate() {
        initializeUI();
    }

    private void initializeUI() {
        setSize(300, 300);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setLayout(new BorderLayout());

        // Create a SpinnerDateModel with current date as the initial value.
        SpinnerDateModel model = new SpinnerDateModel();

        // Set the spinner value to June 8, 2008.
        JSpinner spinner = new JSpinner(model);
        Calendar calendar = new GregorianCalendar(2008, Calendar.JUNE, 8);
        spinner.setValue(calendar.getTime());

        getContentPane().add(spinner, BorderLayout.NORTH);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                new JSpinnerDate().setVisible(true);
            }
        });
    }
}